Docker for Mac: How to use a custom redhat VM instead of the inbuilt docker VM?

Hi,

I have installed docker app for mac (Version 1.12.2-rc1-beta27 (build: 12496) 179c18cae7), I would like to use a custom Redhat VM instead of the inbuilt VM.

Could you pls let me know how to do that?

Thanks

If you install your VM via whatever path you’d normally use, and install Docker on it, then you can set up the Docker remote API and make very very careful port 2375 isn’t accessible from outside the host machine. Then on the host set an environment variable DOCKER_HOST=tcp://192.168.99.100:2375/ where that IP address is the address of your VM.

This is a much closer setup to the Docker Toolbox setup than the “native” Docker for Mac setup, and it might be worth looking closer at what Docker Machine/Docker Toolbox/boot2docker are doing.

If you’re able to work directly on your VM, another very simple answer is to just install the VM, install Docker normally on it, set up your tooling on that, and don’t worry about being able to run the docker command from the host. This is just like working with Docker in an IaaS cloud environment (e.g., AWS): you’d ssh into the machine and do your work there, and not try to set up any sort of direct remote access to Docker.

Thank you for your reply, I tried create a vm using docker-machine. But I am getting below error, could you pls let me know how to fix this issue?

$ docker-machine create -d virtualbox --virtualbox-boot2docker-url rhel-server-
7.2-x86_64-dvd.iso redhat
Running pre-create checks…
(redhat) Boot2Docker URL was explicitly set to "rhel-server-7.2-x86_64-dvd.iso"
at create time, so Docker Machine cannot upgrade this machine to the latest vers
ion.
Creating machine…
(redhat) Boot2Docker URL was explicitly set to "rhel-server-7.2-x86_64-dvd.iso"
at create time, so Docker Machine cannot upgrade this machine to the latest vers
ion.
(redhat) Downloading C:\Users\ram.docker\machine\cache\boot2docker.iso from rh
el-server-7.2-x86_64-dvd.iso…
(redhat) Creating VirtualBox VM…
(redhat) Creating SSH key…
(redhat) Starting the VM…
(redhat) Check network to re-create if needed…
(redhat) Waiting for an IP…
Error creating machine: Error in driver during machine creation: Too many retrie
s waiting for SSH to be available. Last error: Maximum number of retries (60) e
xceeded

When I run docker-machine ls, this is what I get
$ docker-machine ls
NAME ACTIVE DRIVER STATE URL SWARM DO
CKER ERRORS
default * virtualbox Running tcp://192.168.99.100:2376 v1
.12.1
redhat - virtualbox Running Un
known Something went wrong running an SSH command!
command : ip addr show
err : exit status 255
output :