I need to run docker commands from jenkins which is installed as a container on docker. My local setup is on an OSX and I use boot2docker to virtualize the docker machine.
I have installed jenkins on docker by simply docker run -d -p 8080:8080 --name jenkins jenkins
and it is running fine.
On jenkins I have installed "Docker plugin" https://wiki.jenkins-ci.org/display/JENKINS/Docker+Plugin which needs DOCKER URL in order to access docker api.
When boot2docker starts i get the following: DOCKER_HOST=tcp://192.168.59.103:2376
, so I assume docker api is running on that host/por?
On jenkins I set up the DOCKER URL field as http://192.168.59.103:2376
but I get the following error "shaded.org.apache.http.client.ClientProtocolException".
It seems that the container cannot access boot2docker docker server. Maybe I'm missing something but I am not able to figure out what is the correct ip/port I have to use.
Update: More Details
This is what I get when I start boot2docker:
bash-3.2$ unset DYLD_LIBRARY_PATH ; unset LD_LIBRARY_PATH
bash-3.2$ mkdir -p ~/.boot2docker
bash-3.2$ if [ ! -f ~/.boot2docker/boot2docker.iso ]; then cp /usr/local/share/boot2docker/boot2docker.iso ~/.boot2docker/ ; fi
bash-3.2$ /usr/local/bin/boot2docker init
WARNING: The 'boot2docker' command line interface is officially deprecated.
Please switch to Docker Machine (https://docs.docker.com/machine/) ASAP.
Docker Toolbox (https://docker.com/toolbox) is the recommended install method.
Virtual machine boot2docker-vm already exists
bash-3.2$ /usr/local/bin/boot2docker up
WARNING: The 'boot2docker' command line interface is officially deprecated.
Please switch to Docker Machine (https://docs.docker.com/machine/) ASAP.
Docker Toolbox (https://docker.com/toolbox) is the recommended install method.
Waiting for VM and Docker daemon to start...
...............oooooooo
Started.
Writing /Users/local/.boot2docker/certs/boot2docker-vm/ca.pem
Writing /Users/local/.boot2docker/certs/boot2docker-vm/cert.pem
Writing /Users/local/.boot2docker/certs/boot2docker-vm/key.pem
To connect the Docker client to the Docker daemon, please set:
export DOCKER_TLS_VERIFY=1
export DOCKER_HOST=tcp://192.168.59.103:2376
export DOCKER_CERT_PATH=/Users/local/.boot2docker/certs/boot2docker-vm
Or run: `eval "$(boot2docker shellinit)"`
bash-3.2$ $(/usr/local/bin/boot2docker shellinit)
Writing /Users/local/.boot2docker/certs/boot2docker-vm/ca.pem
Writing /Users/local/.boot2docker/certs/boot2docker-vm/cert.pem
Writing /Users/local/.boot2docker/certs/boot2docker-vm/key.pem
bash-3.2$ docker version
Client:
Version: 1.8.0
API version: 1.20
Go version: go1.4.2
Git commit: 0d03096
Built: Tue Aug 11 17:17:40 UTC 2015
OS/Arch: darwin/amd64
Server:
Version: 1.8.0
API version: 1.20
Go version: go1.4.2
Git commit: 0d03096
Built: Tue Aug 11 17:17:40 UTC 2015
OS/Arch: linux/amd64
Here goes the jenkins configuration for the Cloud: