Accessing docker host from (jenkins) docker container -
i need run docker commands jenkins installed container on docker. local setup on osx , use boot2docker virtualize docker machine.
i have installed jenkins on docker docker run -d -p 8080:8080 --name jenkins jenkins
, running fine.
on jenkins have installed "docker plugin" https://wiki.jenkins-ci.org/display/jenkins/docker+plugin needs docker url in order access docker api.
when boot2docker starts following: docker_host=tcp://192.168.59.103:2376
, assume docker api running on host/por?
on jenkins set docker url field http://192.168.59.103:2376
following error "shaded.org.apache.http.client.clientprotocolexception".
it seems container cannot access boot2docker docker server. maybe i'm missing not able figure out correct ip/port have use.
update: more details
this when 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 ]; cp /usr/local/share/boot2docker/boot2docker.iso ~/.boot2docker/ ; fi bash-3.2$ /usr/local/bin/boot2docker init warning: 'boot2docker' command line interface officially deprecated. please switch docker machine (https://docs.docker.com/machine/) asap. docker toolbox (https://docker.com/toolbox) recommended install method. virtual machine boot2docker-vm exists bash-3.2$ /usr/local/bin/boot2docker warning: 'boot2docker' command line interface officially deprecated. please switch docker machine (https://docs.docker.com/machine/) asap. docker toolbox (https://docker.com/toolbox) recommended install method. waiting vm , docker daemon 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 connect docker client 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 jenkins configuration cloud:
as @isanych suggests can -v /var/run/docker.sock:/var/run/docker.sock
, magically work on boot2docker. no need define docker_url
.
you might find --net=host
useful if need access ports of started containers.
Comments
Post a Comment