docker connectivity issue

173 views
Skip to first unread message

Irfan Sayed

unread,
Oct 18, 2015, 10:22:58 AM10/18/15
to jenkins...@googlegroups.com

hi all,

I am trying to provision the build containers dynamically using docker . i have installed jenkins master along with docker plugins . build slave is docker host and all are running on unix setup : centos : 6.5

here is my setup:

Jenkins master : 1.633
cloudbees docker build and publish plugin : 1.0.1
cloudbees docker custom build env plugin : 1.6.1
docker commons plugin : 1.2
docker build step : 1.31
kubernetes plugin : 0.4.1

I have deployed the docker host and created Dockerfile. i am able to build docker image using Dockerfile on the docker host and run in the container
however, from jenkins master , whenever i am trying to connect to docker host and build docker image using docker plugin , i am getting following error

Started by user anonymous
Building remotely on 192.168.102.28 in workspace /tmp/workspace/docker
$ docker inspect 43728998fde0187a1f0b526fef5e2db9b02796a3
[]
Build Docker image from /tmp/workspace/docker/Dockerfile ...
$ docker build --tag 43728998fde0187a1f0b526fef5e2db9b02796a3 --file Dockerfile /tmp/workspace/docker
Sending build context to Docker daemon 497.2 kB

Sending build context to Docker daemon 
Post http://192.168.102.28:22/v1.19/build?cgroupparent=&cpuperiod=0&cpuquota=0&cpusetcpus=&cpusetmems=&cpushares=0&dockerfile=Dockerfile&memory=0&memswap=0&rm=1&t=43728998fde0187a1f0b526fef5e2db9b02796a3: malformed HTTP response "SSH-2.0-OpenSSH_6.4". Are you trying to connect to a TLS-enabled daemon without TLS?
FATAL: Failed to build docker image from project Dockerfile
java.lang.RuntimeException: Failed to build docker image from project Dockerfile
	at com.cloudbees.jenkins.plugins.docker_build_env.Docker.buildImage(Docker.java:121)
	at com.cloudbees.jenkins.plugins.docker_build_env.DockerfileImageSelector.prepareDockerImage(DockerfileImageSelector.java:41)
	at com.cloudbees.jenkins.plugins.docker_build_env.DockerBuildWrapper.setUp(DockerBuildWrapper.java:152)
	at hudson.model.Build$BuildExecution.doRun(Build.java:156)
	at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:537)
	at hudson.model.Run.execute(Run.java:1741)
	at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
	at hudson.model.ResourceController.execute(ResourceController.java:98)
	at hudson.model.Executor.run(Executor.java:408)
Finished: FAILURE

i am not getting what is the triggering point for : 
Are you trying to connect to a TLS-enabled daemon without TLS?

can someone please suggest 
Regards
Irfan

Richard Bywater

unread,
Oct 18, 2015, 6:01:22 PM10/18/15
to jenkins...@googlegroups.com

Have you specified the port 22 from that Docker URL or are the plug-ins doing that as port 22 isn't  right for Docker.

Richard


--
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-use...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/CACGLCJZxveD-sjASD5-oFtE8B%2BXY3xavbz9C0SLur0_dT3xaOQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Irfan Sayed

unread,
Oct 18, 2015, 6:10:09 PM10/18/15
to jenkins...@googlegroups.com
i have just ssh (using port 22) to connect to docker host which is nothing but slave box
this is what i have done.

i haven't specified any docker URL. In job configuration, i have just given the path of Dockerfile and trying to build the image from that Dockerfile

please suggest

Regards


Irfan Sayed

unread,
Oct 18, 2015, 6:30:13 PM10/18/15
to jenkins...@googlegroups.com
further update :

here is the docker process and running and it's PID

[root@localhost docker]# ps -ef | grep docker
root      1623     1  0 12:11 ?        00:00:28 /usr/bin/docker -d --selinux-enabled
root      3480  3415  0 12:54 ?        00:00:00 bash -c cd "/tmp/workspace/docker" && java  -jar slave.jar
root     12299 11158  0 23:00 pts/2    00:00:00 grep --color=auto docker

further, if i run following command:

[root@localhost docker]# docker -H=tcp://192.168.102.28:22 images
Get http://192.168.102.28:22/v1.19/images/json: malformed HTTP response "SSH-2.0-OpenSSH_6.4". Are you trying to connect to a TLS-enabled daemon without TLS?

regards



nicolas de loof

unread,
Oct 18, 2015, 9:37:37 PM10/18/15
to jenkins...@googlegroups.com
Can you run docker commands without setting -H ? 
In this case docker will use /var/run/docker.sock unix socket and not rely on TLS for security, which is the default behavior for access to local daemon.
docker plugins will work the same in such a setup, and you don't have to set a docker host in your jenkins configuration but just let plugin access local daemon.

Irfan Sayed

unread,
Oct 19, 2015, 2:06:24 AM10/19/15
to jenkins...@googlegroups.com

thanks.
when i ssh to slave box (docker host), i can run following comamnd

[root@localhost ~]# docker images
REPOSITORY          TAG                 IMAGE ID            CREATED                  VIRTUAL SIZE
centos7try10        latest              482d7f9db0fc        Less than a second ago   999.4 MB
<none>              <none>              086ff303fac0        Less than a second ago   453.3 MB
centos7try1         latest              5632e539e10f        Less than a second ago   998.9 MB
docker.io/centos    centos7             ce20c473cd8a        Less than a second ago   172.3 MB
jenkins_slave       latest              a8ec8904386f        7 hours ago              172.8 MB
<none>              <none>              2249793a098a        7 hours ago              277.4 MB

just want to re-iterate , slave box and docker host are same box and i am just connecting to slave from jenkins master using ssh 22 port
and using docker plugin to build image form Dockerfile

please suggest

Regards



Irfan Sayed

unread,
Oct 19, 2015, 4:39:03 AM10/19/15
to jenkins...@googlegroups.com
update:
on the build slave configuration , i have set the following variable:

variable : DOCKER_HOST
value : tcp://192.168.102.28:22
does it suffice ?

Do i need to set DOCKER_TLS_VERIFY variable ?

Regards


Richard Bywater

unread,
Oct 19, 2015, 4:43:12 AM10/19/15
to jenkins...@googlegroups.com

You shouldn't be pointing it at Port 22 as that's the SSH port. You'll need to check which tcp port you've got your Docker daemon listening on for Docker API calls.

Richard.


Irfan Sayed

unread,
Oct 20, 2015, 6:06:17 AM10/20/15
to jenkins...@googlegroups.com
Thanks Nicolas and Richard for your valuable inputs
it's resolved.

Regards
Irfan

 

Irfan Sayed

unread,
Oct 23, 2015, 4:41:56 AM10/23/15
to jenkins...@googlegroups.com
Moved further and tried to build the docker image using dockerfile. Jenkins job was able to fetch the dockerfile and build the image.
in the Jenkins job configuration, i have used the docker container as build environment.  
in the dockerfile, i am downloading the maven and setting up the path so that "mvn" commands can be accessed when we start the container.
however, mvn command line is not accessible. Here are the crispy Jenkins  log:

Docker container 87de3c721ba5c07e84bc006d539ed8849a5dae4ecf06be3bb69fa9746bebc9ec started to host the build

PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin PWD=/tmp/workspace/docker SELINUX_LEVEL_REQUESTED= SELINUX_ROLE_REQUESTED= SELINUX_USE_CURRENT_RANGE= SHELL=/bin/bash SHLVL=1 "SSH_CLIENT=192.168.102.19 56356 22" "SSH_CONNECTION=192.168.102.19 56356 192.168.102.28 22" USER=root WORKSPACE=/tmp/workspace/docker XDG_RUNTIME_DIR=/run/user/0 XDG_SESSION_ID=602 XFILESEARCHPATH=/usr/dt/app-defaults/%L/Dt mvn clean package
env: mvn: No such file or directory
Build step 'Invoke top-level Maven targets' marked build as failure
Stopping Docker container after build completion
$ docker kill c9daf81ddb63d099a10ddba419ea78d690061786cb68b5cbe5ceddbc0366dcb1
c9daf81ddb63d099a10ddba419ea78d690061786cb68b5cbe5ceddbc0366dcb1
$ docker rm --force c9daf81ddb63d099a10ddba419ea78d690061786cb68b5cbe5ceddbc0366dcb1
c9daf81ddb63d099a10ddba419ea78d690061786cb68b5cbe5ceddbc0366dcb1

I am not getting how the path is not getting setup.
when i tried locally, using docker attach command to work on container, i am able to access mvn command

please suggest 

Regards,
Irfan

 

Irfan Sayed

unread,
Oct 23, 2015, 6:01:17 PM10/23/15
to jenkins...@googlegroups.com
please find the attached dockerfile 
please suggest 

Regards
irfan

Dockerfile.txt

Irfan Sayed

unread,
Oct 24, 2015, 8:31:42 AM10/24/15
to jenkins...@googlegroups.com
please suggest 
I did search but not able to find

Regards
Irfan

Irfan Sayed

unread,
Oct 25, 2015, 8:23:33 AM10/25/15
to jenkins...@googlegroups.com
please suggest. 
i tried attaching to docker container and executing system command like "java -version" and it works locally / manually 
but through Jenkins it is not ...
I am not getting what configuration i am missing 

Regards
irfan

Irfan Sayed

unread,
Oct 26, 2015, 3:50:37 PM10/26/15
to jenkins...@googlegroups.com
It's resolved...
actually i did use the yum command and left everything on that to setup the PATH and all.

Regards
irfan

Reply all
Reply to author
Forward
0 new messages