Given these two systems:
- VM#1 running a jenkins-container which has a installed/working
docker-machine
- VM#2 running a plain ubuntu with
docker-engine
installed
Both VMs are connected via a networkbridge. I can curl for the Docker-Host on VM#2 out of the jenkins container.
Now I want to tell docker-machine
within my jenkins container to build an image (which lies within a jenkins workspace) by using the VM#2 Docker-Host.
All documentation about this only show me drivers like virtualbox or aws but I want to connect to my own created Docker-Host.
What I tried:
In my Jenkins Container I created two Environent Variables:
$ export DOCKER_HOST=tcp://192.168.0.102:2375
$ export DOCKER_MACHINE_NAME=dev
curl 192.168.0.102:2375
yields {"message":"page not found"}
running docker-machine env dev
gives me Host does not exist: "dev"
PS:
I do not want to install
docker-engine
into my jenkins image. I want to use the thin-clientdocker-machine
to delegate the image build over to VM#2 and nothing more
Assuming VM#1 is
192.168.33.100
and VM#2 is192.168.33.101
. Both can reach each other. Now you don't need to getdocker-machine
into picture at all. You can just do belowassuming you opened port 2375 for the docker host. See the below url for detail on this environment variable
https://docs.docker.com/engine/reference/commandline/cli/#environment-variables
Edit-1
If you want to add an exiting machine to
docker-machine
you can do it using below