Run Docker And Virtualbox On Windows 10

Docker Toolbox is a cool tool for working with Docker containers on OS X and Windows, and it bundles Oracle’s VirtualBox.1 But if you have Hyper-V installed and active, you can’t also use VirtualBox.

Read on for how to use Hyper-V with Docker Toolbox …

Prerequisites

Switching between Docker and VirtualBox on Windows 10 15 Mar 2018 #Docker #Windows. As outlined here, Docker for Windows requires Hyper-V.This needs to be disabled before you can run VirtualBox.

If you run into issues creating VMs, you may need to uninstall VirtualBox before re-installing the Docker Toolbox. The following list of components is included with this Toolbox release. If you have a previously installed version of Toolbox, these installers will update the components to these versions. Included Components. Run it to install. Also, those running older version they should update their VBox software to the latest version. Configure Paravirtualization Interface. To make VirtualBox compatible with Hyper-V on Windows 10, this step is very important. What we have to do is, run the VirtualBox on your system, select the created Machine that you want to.

This guide assumes you have Hyper-V running on your machine, configured with an External Virtual Switch. It also assumes your system is Windows 10, but I would not be surprised to find that Windows 8.1 and Server 2012 R2 are also sufficient.

  • Windows 10 Professional or Enterprise
  • Hardware virtualization enabled (you do this in the BIOS of the machine)
  • Hyper-V installed
  • An external virtual switch configured in Hyper-V (use the Virtual Switch Manager in the Hyper-V Manager)

We would prefer to use an internal virtual switch, but that doesn’t work due to some bugs in IPv6 support in Docker Machine (as of version 0.5.6, build 61388e9). The bugs will likely be fixed in version 0.6, so when that comes out these instructions will be updated.

Installing Docker Toolbox

Download the Windows version of Docker Toolbox from here: https://www.docker.com/docker-toolbox. Run the install, accepting all the defaults.

VirtualBox cleanup

That installed Oracle’s VirtualBox, which is incompatible with Hyper-V—they cannot both be enabled on the system at the same time. The VirtualBox install adds some drivers and network adapters. Which means there is a little bit of cruft that you should clean up. To do that:

  1. In Control Panel, go to “Network and Internet”, then “Network and Sharing Center”, and select “Change adapter settings”.
  2. Disable the “VirtualBox Host-Only Network” adapter.
  3. In the properties of your ‘Internet’ adapter—the one probably called just “Ethernet” and through which you are connect to the LAN—uncheck “VirtualBox NDIS6 Bridged Networking Driver” and make sure “Hyper-V Extensible Virtual Switch” is checked.
  4. In the properties of each “vEthernet” adapter (which are Hyper-V virtual switches), uncheck “VirtualBox NDIS6 Bridged Networking Driver”

Create a Hyper-V VM using the Docker Machine

Now you’ll use Docker Machine to create a lightweight Linux VM, hosted by Hyper-V, and running the Docker Manager. Make sure you do have an external virtual switch configured in Hyper-V and that you know what it’s name is—you’ll need to supply that name on the command line.

  1. Open a command window using “Run as administrator”.
  2. cd to C:Program FilesDocker Toolbox.
  3. Enter the command to create and provision the Docker VM …

In the command above you should supply the name of your virtual switch for the --hyperv-virtual-switch argument. The other --hyperv-* arguments are the default values, so you don’t need to supply them unless you want something different—for example, I usually set the CPU count to 2, not 1. Memory is specified in KB, and disk size in MB. Use some unique machine name, not “mydockervm”—remember this is using the external virtual switch, thus it will be visible on the LAN and will use the DHCP service of the LAN, and so you should avoid duplicating the name of another system on the network.

That command will create the VM and provision it via SSH. When it completes then you’ll see:

Connecting to your docker VM

In an administrative command window, enter this command to set some required environment variables:

Then you can SSH to the system using:

Note about SSH

If you have a command line SSH client already installed on the system, and it is in the path, then docker-machine ssh will use that. If no SSH executable is found, then docker-machine will use a built-in Golang version of SSH.

I’ve found that with docker-machine version 0.5.6 there are terminal issues with the Golang SSH from Windows. For instance, using vi in an SSH session doesn’t work well because the ESC key doesn’t seem to be communicate properly (so once you are in ‘insert mode’ in vi you can’t ESC back out to ‘command mode’ and thus cannot quit the vi session or save your edits).

My solution to this was to install PuTTY and open a separate SSH connection and terminal window with that tool. If you establish an SSH session with your Docker VM without using docker-machine ssh then you will be prompted for userid and password. Per the boot2docker image README, use docker for the userid and tcuser for the password.

Other useful commands

  • To stop the docker VM: docker-machine stop mydockervm
  • To start the docker VM: docker-machine start mydockervm
  • To restart the docker VM: docker-machine restart mydockervm
  • To delete the docker VM: docker-machine rm mydockervm
  • Other things: docker-machine --help

Now what?

OK, you’ve got your container host and can start learning about and using Docker containers. Here are some starting points and references:

  • The Docker Book, by James Turnbull
  • Docker Cookbook, by Sébastien Goasguen

To learn about Docker and containers, I’d recommend getting The Docker Book and working through it. Then use the Docker documentation and the Docker Cookbook to help you with specific applications of containers and Docker.

Have fun!

  1. so that you can run Linux VMs—Linux being necessary to host containers and the Docker Engine. ↩

Recently I started working on a brand new HP ZBook 15-G3 with Windows 10 Pro. And I immediately tried to return to the state I had my previous Windows 7 laptop in: Oracle Virtual Box for running most software in virtual machines, using Docker Machine (and Kubernetes) for running some things in Docker Containers and using Vagrant to spin up some of these containers and VMs.

I quickly ran into some issues that made me reconsider – and realize that some things are different on Windows 10. In this article a brief summary of my explorations and findings.

  • Docker for Windows provides near native support for running Docker Containers; the fact that under the covers there is still a Linux VM running is almost hidden and from command line (Powershell) and a GUI I have easy access to the containers. I do not believe though that I can run containers that expose a GUI – except through a VNC client
  • Docker for Windows leverages Hyper-V. Hyper-V lets you run an operating system or computer system as a virtual machine on Windows. (Hyper-V is built into Windows as an optional feature; it needs to be explicitly enabled) Hyper-V on Windows is very similar to VirtualBox
  • In order to use Hyper-V or Virtual Box, hardware virtualization must be enabled in the system’s BIOS
  • And the one finding that took longest to realize: Virtual Box will not work if Hyper-V is enabled. So the system at any one time can only run Virtual Box or Hyper-V (and Docker for Windows), not both. Switching Hyper-V support on and off is fairly easy, but it does require a reboot

Quick tour of Windows Hyper-V

Creating a virtual machine is very easy. A good example is provided in this article: https://blog.couchbase.com/hyper-v-run-ubuntu-linux-windows/ that describes how a Hyper-V virtual machine is created with Ubuntu Linux.

I went through the following steps to create a Hyper-V VM running Fedora 26. It was easy enough. However, the result is not as good in terms of the GUI experience as I had hoped it would be. Some of my issues: low resolution, only 4:3 aspect ratio, I cannot get out of full screen mode (that requires CTRL-ALT-BREAK and my keyboard does not have a break key. All alternative I have found do not work for me.

    • Download ISO image for Fedora 26 (Fedora-Workstation-Live-x86_64-26-1.5.iso using Fedora Media Writer or from https://fedora.mirror.wearetriple.com/linux/releases/26/Workstation/x86_64/iso/)
    • Enable Virtualization in BIOS
    • Enable Hyper-V (First, open Control Panel. Next, go to Programs. Then, click “Turn Windows features on or off”. Finally, locate Hyper-V and click the checkbox (if it isn’t already checked))
    • Run Hyper-V Manager – click on search, type Hype… and click on Hype-V Manager
    • Create Virtual Switch – a Network Adapter that will allow the Virtual Machine to communicate to the world
    • Create Virtual Machine – specify name, size and location of virtual hard disk (well, real enough inside he VM, virtual on your host), size of memory, select the network switch (created in the previous step), specify the operating system and the ISO while where it will be installed from
    • Start the virtual machine and connect to it. It will boot and allow you to run through the installation procedure
    • Potentially change the screen resolution used in the VM. That is not so simple: see this article for an instruction: https://www.netometer.com/blog/?p=1663 Note: this is one of the reasons why I am not yet a fan of Hyper-V
    • Restart the VM an connect to it; (note: you may have to eject the ISO file from the virtual DVD player, as otherwise the machine could boot again from the ISO image instead of the now properly installed (virtual) hard disk

References

Article that explains how to create a Hyper-V virtual machine that runs Ubuntu (including desktop): https://blog.couchbase.com/hyper-v-run-ubuntu-linux-windows/

Microsoft article on how to use local resources (USB, Printer) inside Hyper-V virtual machine: https://docs.microsoft.com/en-us/windows-server/virtualization/hyper-v/learn-more/Use-local-resources-on-Hyper-V-virtual-machine-with-VMConnect

Microsoft documentation: introduction of Hypervisor Hyper-v on Windows 10: https://docs.microsoft.com/en-us/virtualization/hyper-v-on-windows/about/

Two article on converting Virtual Box VM images to Hyper-V: https://cloudbase.it/convert-virtualbox-to-hyper-v/ and (better) https://www.groovypost.com/howto/migrate-virtual-box-vms-windows-10-hyper-v/

And: how to create one’s own PC into a Hyper-V VM: http://www.online-tech-tips.com/free-software-downloads/convert-pc-into-virtual-machine/

Rapid intro to Docker on Windows

Getting going with Docker on Windows is surprisingly simple and pleasant. Just install Docker for Windows (see for example article for instructions: https://www.htpcbeginner.com/install-docker-on-windows-10/ ). Make sure that Hyper-V is enabled – because Docker for Windows leverages Hyper-V to run a Linux VM: the MobyLinuxVM that you see the details for in the next figure.

At this point you can interact with Docker from the Powershell command line – simply type docker ps, docker run, docker build and other docker commands on your command line. To just run containers based on images – local or in public or private registries – you can use the Docker GUI Kitematic. It is a separate install action – – that is largely automated as is described here https://www.htpcbeginner.com/install-kitematic-on-windows/ –to get Kitematic installed. That is well worth the extremely small trouble it is.

From Kitematic, you have a graphical overview of your containers as well as an interactive UI for starting containers, configuring them, inspecting them and interacting with them. All things you can do from the command line – but so much simpler.

In this example, I have started a container based on the ubuntu-xfce-nvc image (see https://hub.docker.com/r/consol/ubuntu-xfce-vnc/) which runs the Ubuntu Linux distribution with “headless” VNC session, Xfce4 UI and preinstalled Firefox and Chrome browser.

The Kitematic IP & Ports tab specify that port 5901 – the VNC port – is mapped to port 32769 on the host (my Windows 10 laptop). I can run the MobaXterm tool and open a VNC session with it, fir 127.0.0.1 at port 32769. This allows me to remotely (or at least outside of the container) see the GUI for the Ubuntu desktop:

Run docker and virtualbox on windows 10 64bit

Even though it looks okay and it is pretty cool that I can graphically interact with the container, it is not a very good visual experience – especially when things start to move around. Docker for Windows is really best for headless programs that run in the background.

For quickly trying out Docker images and for running containers in the background – for example with a MongoDB database, an Elastic Search Index and a Node.JS or nginx web server – this seems to be a very usable way of working.

References

Introducing Docker for Windows: https://docs.docker.com/docker-for-windows/ Documentation

Download Docker for Windows Community Edition: https://www.docker.com/community-edition#/download

Article on installation for Kitematic – the GUI for Docker for Windows: https://www.htpcbeginner.com/install-kitematic-on-windows/

Download MobaXterm: http://mobaxterm.mobatek.net/

Virtual Box on Windows 10

My first impressions on Virtual Box compared to Hyper-V that for now at least I far prefer Virtual Box(for running Linux VMs).The support for shared folders between host and guest, the high resolution GUI for the Guest, and the fact that currently many prebuilt images are available for Virtual Box and not so many (or hardly any) for Hyper-V are for now points in favor of Virtual Box. I never run VMs with Windows as Guest OS, I am sure that would impact my choice.

Note- once more- that for VirtualBox to run on Windows 10, you need to make sure that hardware virtualization is enabled in BIOS and that Hyper-V is not enabled. Failing to take care of either of these two will return the same error VT-x is not available (VERR_VMX_NO_VMX):

Here is a screenshot of a prebuilt VM image running on Virtual Box on Windows 10 – all out of the box.

No special set up required. It uses the full screen, it can interact with the host, is clipboard enabled, I can easily toggle between guest and host and it has good resolution and reasonable responsiveness:

Resources

Article describing setting up two boot profiles for Windows 10 – one for Hyper-V and one without it (for example run Virtual Box): https://marcofranssen.nl/switch-between-hyper-v-and-virtualbox-on-windows/

Article that explains how to create a Hyper-V virtual machine that runs Ubuntu (including desktop): https://blog.couchbase.com/hyper-v-run-ubuntu-linux-windows/

Microsoft article on how to use local resources (USB, Printer) inside Hyper-V virtual machine: https://docs.microsoft.com/en-us/windows-server/virtualization/hyper-v/learn-more/Use-local-resources-on-Hyper-V-virtual-machine-with-VMConnect

Microsoft documentation: introduction of Hypervisor Hyper-v on Windows 10: https://docs.microsoft.com/en-us/virtualization/hyper-v-on-windows/about/

HP Forum Entry on enabling Virtualization in BIOS fo ZBook G2 : https://h30434.www3.hp.com/t5/Business-Notebooks/Enable-hardware-virtualization-on-HP-ZBOOK-15-G2/td-p/5513726

Introducing Docker for Windows: https://docs.docker.com/docker-for-windows/ Documentation

Run Docker And Virtualbox On Windows 10 Free

Download Docker for Windows Community Edition: https://www.docker.com/community-edition#/download

Article on installation for Kitematic – the GUI for Docker for Windows: https://www.htpcbeginner.com/install-kitematic-on-windows/

Two article on converting Virtual Box VM images to Hyper-V: https://cloudbase.it/convert-virtualbox-to-hyper-v/ and (better) https://www.groovypost.com/howto/migrate-virtual-box-vms-windows-10-hyper-v/

Run Docker And Virtualbox On Windows 10 Download

And: how to create one’s own PC into a Hyper-V VM: http://www.online-tech-tips.com/free-software-downloads/convert-pc-into-virtual-machine/

Run Docker And Virtualbox On Windows 10 64bit

Related posts: