docker_use_on_windows_with_virtualbox_without_docker_toolbox - DmitrySemikin/dsemikin_notes GitHub Wiki
Use Docker on Windows with VirtualBox wihout using Docker Toolbox
NOTE: As MS tends to use Hyper-V in more and more applications on system level (like WSL, sandboxing etc), it seems that Oracle decided to make it possible to run VirtualBox on top of Hyper-V since VirtualBox-6. It is only experimental feature for now: https://docs.oracle.com/en/virtualization/virtualbox/6.0/admin/hyperv-support.html. As soon as this solution works reliably, the need to disable Hper-V for running VirtualBox is eliminated and the whole topic becomes less relevant.
Problem: Docker Desktop for windows requires Hyper-V, which makes its use together with VirtualBox not really convenient (simultaneous use is simply impossible --- see note at the beginning).
Previous solution: Use Docker Toolbox, which uses VirtualBox to run Linux VM with Docker server instead of Hyper-V based solution used by Docker Desktop. Docker Toolbox page on github: https://github.com/docker/toolbox/releases.
New Problem: Docker Toolbox seems to be discontinued.
Solution: If we look at how Docker Toolbox works, we can see, that we can build the same setup manually. Docker toolbox provided us just some convenience around it.
Indeed, docker uses client-server approach. And it is possible to work (pretty much seamlessly) with remote Docker engine. See e.g. here: https://www.digitalocean.com/community/tutorials/how-to-use-a-remote-docker-server-to-speed-up-your-workflow.
To do it we just need to set a variable DOCKER_HOST
to ssh://username@your_server_ip
.
This also matches to what Docker Toolbox did. If we run docker-machine env
, then we get the output, which will look like this:
docker-machine env
$Env:DOCKER_TLS_VERIFY = "1"
$Env:DOCKER_HOST = "tcp://192.168.99.100:2376"
$Env:DOCKER_CERT_PATH = "C:\Users\someuser\.docker\machine\machines\default"
$Env:DOCKER_MACHINE_NAME = "default"
$Env:COMPOSE_CONVERT_WINDOWS_PATHS = "true"
# Run this command to configure your shell:
# & "C:\Program Files\Docker Toolbox\docker-machine.exe" env | Invoke-Expression
which also contains DOCKER_HOST
command (but with "tcp" protocol - not sure about the difference.
So finally the solution is simple:
- Create VM manually
- Install linux of your choise (which is capable of running docker). I am not sure, if it will work with
podman
on centos. - [??? HOW] Install on windows docker client - To be specified... Probably we can install Docker Desktop and then disable Hyper-V
- Set
DOCKER_HOST
variable to your VM - Start VM
- Enjoy.