Reputation: 71
I'm trying to use Docker Machine to connect to a Docker VirtualBox VM on a different host. At my local host, the setup is successful, including examples installing Busybox and echo a 'hello world' from a VM called 'dev', like this:
$ docker $(docker-machine config dev) run busybox echo hello world
I can create as many comparable local Docker VirtualBox VMs I like with Docker Machine and the result is similar succesful.
Now I would like to do the same using my local Docker Machine and execute docker commands on a different physical host where I installed Docker Machine and Boot2Docker as well. In other words: I would like to use my local Docker Machine CLI and remotely command to e.g. pull an image and run a container on that different host. Is that possible, and if so, how?
Upvotes: 5
Views: 6403
Reputation: 13
I just tested with dind (Docker-in-Docker) here is the link So all you have to do is run this in your host: Docker Host IP: 172.17.42.1
you can create another node by
docker -H tcp://DOCKER_HOST:1235 run -d swarm join --addr=DOCKER_HOST:1235 token://cluster_id
docker run -d -p 2375:2375 swarm manage token://cluster_id
Check is everything OK docker -H tcp://DOCKER_HOST:2375 info
If you see 2 container, you are successfully created swarm cluster and docker machines as docker container.
Upvotes: 2
Reputation: 166
This cannot be done. For your local machine installation to be able to connect to a machine, it has to be the one to create that machine so that it can keep track of TLS certs and other connection details.
The VBox driver is meant to be used on your localhost. While drivers like the one for digitalocean is meant to create a VM on digitalocean where you can run containers.
If you really want to get this to work you could try to create a wrapper that uses SSH to execute commands on the other computer, other than that you are out of luck.
Machine is intended to be used as a docker host provisioner. It creates servers that are ready to run docker containers.
Upvotes: 1