We are trying to do the auto deployment of docker image to EC2 container. 
 We thought of doing the following.

1.       Created the Jenkins Jobs – to get the code from git hub, prepare 
the image  and push the image to private docker hub (which is created on 
docker.com ) using CloudBees Docker Build and Publish plugin 
<https://github.com/jenkinsci/docker-build-publish-plugin/blob/master/README.md>

2.       Than thought of deploy the docker image from docker hub to EC2 
instance. 

 

Can you please guide me with the proper steps to make auto deployment of 
docker images to EC2 instance. I added the following post build step for 
the docker build and publish.

<https://lh3.googleusercontent.com/-w2p2mz_F5UI/VbJZKkKatfI/AAAAAAAABkE/jVg0mqWi040/s1600/testpic.png>


 

But here my doubt is what will the docker host URI, server credentials (not 
able to see any details in the drop down even after adding from add 
button). For testing I gave the values for Repository name, tag, docker 
host url left blank, server credentials left blank. *Given the values for 
docker registry as **https://registry.hub.docker.com/u/ABCD/javatest/* 
<https://registry.hub.docker.com/u/ABCD/javatest/>* and by clicking on Add 
button given the registry credentials*.

 

1.       When I trigger the build from Jenkins getting the following error.
  
ERROR: Build step failed with exception

net.sf.json.JSONException: null object

        at net.sf.json.JSONObject.verifyIsNull(JSONObject.java:2688)

        at net.sf.json.JSONObject.element(JSONObject.java:1733)

        at net.sf.json.JSONObject.element(JSONObject.java:1716)

        at net.sf.json.JSONObject.put(JSONObject.java:2328)

        at 
org.jenkinsci.plugins.docker.commons.credentials.DockerRegistryToken$1.call(DockerRegistryToken.java:100)

        at 
org.jenkinsci.plugins.docker.commons.credentials.DockerRegistryToken$1.call(DockerRegistryToken.java:71)

        at hudson.remoting.LocalChannel.call(LocalChannel.java:45)

        at 
org.jenkinsci.plugins.docker.commons.credentials.DockerRegistryToken.newKeyMaterialFactory(DockerRegistryToken.java:71)

        at 
org.jenkinsci.plugins.docker.commons.credentials.DockerRegistryEndpoint.newKeyMaterialFactory(DockerRegistryEndpoint.java:204)

        at 
org.jenkinsci.plugins.docker.commons.credentials.DockerRegistryEndpoint.newKeyMaterialFactory(DockerRegistryEndpoint.java:193)

        at 
com.cloudbees.dockerpublish.DockerBuilder$Perform.executeCmd(DockerBuilder.java:381)

        at 
com.cloudbees.dockerpublish.DockerBuilder$Perform.executeCmd(DockerBuilder.java:359)

        at 
com.cloudbees.dockerpublish.DockerBuilder$Perform.buildAndTag(DockerBuilder.java:305)

        at 
com.cloudbees.dockerpublish.DockerBuilder$Perform.exec(DockerBuilder.java:252)

        at 
com.cloudbees.dockerpublish.DockerBuilder$Perform.access$100(DockerBuilder.java:233)

        at 
com.cloudbees.dockerpublish.DockerBuilder.perform(DockerBuilder.java:208)

        at hudson.tasks.BuildStepMonitor$1.perform(BuildStepMonitor.java:20)

        at 
hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:779)

        at 
hudson.maven.MavenModuleSetBuild$MavenModuleSetBuildExecution.build(MavenModuleSetBuild.java:906)

        at 
hudson.maven.MavenModuleSetBuild$MavenModuleSetBuildExecution.doRun(MavenModuleSetBuild.java:857)

        at 
hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:537)

        at hudson.model.Run.execute(Run.java:1741)

        at 
hudson.maven.MavenModuleSetBuild.run(MavenModuleSetBuild.java:529)

        at 
hudson.model.ResourceController.execute(ResourceController.java:98)

        at hudson.model.Executor.run(Executor.java:381)

Build step 'Docker Build and Publish' marked build as failure
  
 

2.       When I give the value as none for ‘*the registry credentials’ *getting 
the following error*.*

 
  
Image push failed

Please login prior to push:

Username: EOF

Build step 'Docker Build and Publish' marked build as failure
  
 

*Following is the docker file:*       
  
FROM java:7

MAINTAINER tester

ADD sample.jar /test/sample.jar

RUN chmod +x /test/sample.jar
  
 

Following are the configuration/environment:

Java version "1.8.0_40"

Linux -  x86_64 -  GNU/Linux

Docker version 1.7.1, build 786b29d

Jenkins version - 1.620

CloudBees Docker Build and Publish plugin 
<https://github.com/jenkinsci/docker-build-publish-plugin/blob/master/README.md>
 
– 1.0

Docker Commons Plugin – 1.1

 

*sudo docker version >>*

Client version: 1.7.1

Client API version: 1.19

Go version (client): go1.4.2

Git commit (client): 786b29d

OS/Arch (client): linux/amd64

Server version: 1.7.1

Server API version: 1.19

Go version (server): go1.4.2

Git commit (server): 786b29d

OS/Arch (server): linux/amd64

LSB Version:    :base-4.0-amd64

CentOS:    CentOS release 6.6 (Final)

-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to jenkinsci-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/af649e9e-dbf0-41e2-a358-90f75c678c91%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to