Estimated reading time: 7 minutes

Docker Desktop for Windows is the Community version of Docker for Microsoft Windows.You can download Docker Desktop for Windows from Docker Hub.

Docker; Development; Last night I got a little surprise: an email invitation to the beta for Docker for Mac that included an invite code. I had forgotten I had applied to be part of the private beta a few weeks / months ago so it was quite the pleasant surprise. This can be done using the command line or the Kitematic GUI interface (a separate download that works with the Mac beta). Using the official Docker image for the latest stable version of Node.js, here is a one-line command that runs some JavaScript code using new EcmaScript 6 features in a container named “test-node”.

This page contains information on installing Docker Desktop on Windows 10 Pro, Enterprise, and Education. If you are looking for information about installing Docker Desktop on Windows 10 Home, see Install Docker Desktop on Windows Home.

By downloading Docker Desktop, you agree to the terms of the Docker Software End User License Agreement and the Docker Data Processing Agreement.

What to know before you install

System Requirements

  • Windows 10 64-bit: Pro, Enterprise, or Education (Build 16299 or later).

    For Windows 10 Home, see Install Docker Desktop on Windows Home.

  • Hyper-V and Containers Windows features must be enabled.
  • The following hardware prerequisites are required to successfully run ClientHyper-V on Windows 10:

    • 64 bit processor with Second Level Address Translation (SLAT)
    • 4GB system RAM
    • BIOS-level hardware virtualization support must be enabled in theBIOS settings. For more information, seeVirtualization.

Note: Docker supports Docker Desktop on Windows based on Microsoft’s support lifecycle for Windows 10 operating system. For more information, see the Windows lifecycle fact sheet.

What’s included in the installer

The Docker Desktop installation includes Docker Engine,Docker CLI client, Docker Compose,Notary,Kubernetes,and Credential Helper.

Containers and images created with Docker Desktop are shared between alluser accounts on machines where it is installed. This is because all Windowsaccounts use the same VM to build and run containers. Note that it is not possible to share containers and images between user accounts when using the Docker Desktop WSL 2 backend.

Nested virtualization scenarios, such as running Docker Desktop on aVMWare or Parallels instance might work, but there are no guarantees. Formore information, see Running Docker Desktop in nested virtualization scenarios.

About Windows containers

Looking for information on using Windows containers?

  • Switch between Windows and Linux containersdescribes how you can toggle between Linux and Windows containers in Docker Desktop and points you to the tutorial mentioned above.
  • Getting Started with Windows Containers (Lab)provides a tutorial on how to set up and run Windows containers on Windows 10, Windows Server 2016 and Windows Server 2019. It shows you how to use a MusicStore applicationwith Windows containers.
  • Docker Container Platform for Windows articles and blogposts on the Docker website.

Install Docker Desktop on Windows

  1. Double-click Docker Desktop Installer.exe to run the installer.

    If you haven’t already downloaded the installer (Docker Desktop Installer.exe), you can get it from Docker Hub. It typically downloads to your Downloads folder, or you can run it from the recent downloads bar at the bottom of your web browser.

  2. When prompted, ensure the Enable Hyper-V Windows Features option is selected on the Configuration page.

  3. Follow the instructions on the installation wizard to authorize the installer and proceed with the install.

  4. When the installation is successful, click Close to complete the installation process.

  5. If your admin account is different to your user account, you must add the user to the docker-users group. Run Computer Management as an administrator and navigate to Local Users and Groups > Groups > docker-users. Right-click to add the user to the group.Log out and log back in for the changes to take effect.

Start Docker Desktop

Docker Desktop does not start automatically after installation. To start Docker Desktop, search for Docker, and select Docker Desktop in the search results.

When the whale icon in the status bar stays steady, Docker Desktop is up-and-running, and is accessible from any terminal window.

If the whale icon is hidden in the Notifications area, click the up arrow on thetaskbar to show it. To learn more, see Docker Settings.

When the initialization is complete, Docker Desktop launches the onboarding tutorial. The tutorial includes a simple exercise to build an example Docker image, run it as a container, push and save the image to Docker Hub.

Congratulations! You are now successfully running Docker Desktop on Windows.

If you would like to rerun the tutorial, go to the Docker Desktop menu and select Learn.

Uninstall Docker Desktop

To uninstall Docker Desktop from your Windows machine:

  1. From the Windows Start menu, select Settings > Apps > Apps & features.
  2. Select Docker Desktop from the Apps & features list and then select Uninstall.
  3. Click Uninstall to confirm your selection.

Note: Uninstalling Docker Desktop will destroy Docker containers and images local to the machine and remove the files generated by the application.

Switch between Stable and Edge versions

Docker Desktop allows you to switch between Stable and Edge releases. However, you can only have one version of Docker Desktop installed at a time. Switching between Stable and Edge versions can destabilize your development environment, particularly in cases where you switch from a newer (Edge) channel to an older (Stable) channel.

For example, containers created with a newer Edge version of Docker Desktop maynot work after you switch back to Stable because they may have been createdusing Edge features that aren’t in Stable yet. Keep this in mind asyou create and work with Edge containers, perhaps in the spirit of a playgroundspace where you are prepared to troubleshoot or start over.

Experimental features are turned on by default on Edge releases. However, when you switch from a Stable to an Edge release, you must turn on the experimental features flag to access experimental features. From the Docker Desktop menu, click Settings > Command Line and then turn on the Enable experimental features toggle. Click Apply & Restart for the changes to take effect.

To safely switch between Edge and Stable versions, ensure you save images and export the containers you need, then uninstall the current version before installing another. For more information, see the section Save and Restore data below.

Save and restore data

You can use the following procedure to save and restore images and container data. For example, if you want to switch between Edge and Stable, or to reset your VM disk:

  1. Use docker save -o images.tar image1 [image2 ...] to save any images you want to keep. See save in the Docker Engine command line reference.

  2. Use docker export -o myContainner1.tar container1 to export containers you want to keep. See export in the Docker Engine command line reference.

  3. Uninstall the current version of Docker Desktop and install a different version (Stable or Edge), or reset your VM disk.

  4. Use docker load -i images.tar to reload previously saved images. See load in the Docker Engine.

  5. Use docker import -i myContainer1.tar to create a file system image corresponding to the previously exported containers. See import in the Docker Engine.

For information on how to back up and restore data volumes, see Backup, restore, or migrate data volumes.

Where to go next

  • Getting started introduces Docker Desktop for Windows.
  • Get started with Docker is a tutorial that teaches you how todeploy a multi-service stack.
  • Troubleshooting describes common problems, workarounds, andhow to get support.
  • FAQs provides answers to frequently asked questions.
  • Stable Release Notes or Edge Release Notes.
windows, install, download, run, docker, local

I've finally had a chance to install the new Docker for Mac Beta and give it a whirl. In this article I'm going to talk a bit about how Docker works, the challenges of running Docker on a Mac or Windows and how the new Beta helps.

Below: The welcome message for the new Docker for Mac app

If you don't know what Docker is, check out my article Learn Docker by Building a Microservice or the lovely What is Docker page from the docs.

You may be aware that Docker creates processes in isolated containers using some key Linux technologies which allow for low-level isolation (such as namespaces and cgroups1).

Docker Mac Os Download

This is described in detail on the Understand the Docker Architecture page, but essentially means we can do this:

Here I have:

  1. My machine, called Dave-Ubuntu, which is running Ubuntu2, with a local IP 192.168.0.1.
  2. The docker executable, which I use to issue commands to…
  3. …the Docker Host, which runs the docker daemon, which actually does the work of starting/stopping/building containers and so on.
  4. Some containers in the Docker Host - one is based on a MySQL image and has a DB, one is based on a Node.js image and is running an app.

The Docker host is actually my machine - I can connect using the loopback IP 127.0.0.1 (i.e. localhost). The containers also have the IP of the host. If I want to create and connect to a MySQL DB from my machine, I just type:

The container was created on my machine (in the host) and addressable using my loopback IP.

So What?

This is all great, but things get a little harder on a Mac or Windows. MacOS and the Windows OS don't have the same kernel level support for process isolation, control groups and so on, so the Docker Host cannot run on these operating systems. Instead, an extra layer and component is introduced:

What's new?

  1. Oracle VirtualBox has been installed to create and manage virtual machines.
  2. A virtual machine running Linux (called in this case a ‘docker machine’) called ‘default’ has been created (by convention with the IP 192.168.99.100).
  3. This virtual machine runs Linux, so can perfectly happily act as the docker host.
  4. The docker host is still addressable as 127.0.0.1 - from the virtual machine - from the outside world (i.e. my Mac) I have to use the virtual machine IP.

So this is how Docker works on a Mac or on Windows. Things are made seemless where possible, for example, all of the required components are installed when you install the Docker Toolbox.

So What?

Well the problem here is that one of the big benefits of using docker is that it allows us to create development environments which are much closer to production environments (at least from a software point of view).

This kind of breaks down if we are doing development on a Mac or on Windows - because we have introduced an additional component which is simply not going to be present in our production environment. What are the problems?

Docker mac os download

1. Localhost vs docker-machine IP

Docker helps us be a lot more agnostic to our development box, but if I'm writing about how to interact with docker containers there's a problem:

This works on a Linux machine - it does not work on a Mac or Windows. On a Mac I need to run something like:

This will not work on Linux or Windows.

Is this a big deal? Actually, kind of. What if I have an integration test which spins up some containers and runs calls against them - the test has to know about the execution environment. That's a pain. An alternative is to run tests in a container and link them with something like docker-compose, but this is not ideal.

2. Terminal Hassle

If I open a terminal and check to see what containers are running:

I'll see nothing. If I try to run a container:

I'll get an error - because my docker instance cannot communicate with the host. I need to use a specially set up terminal to tell it to connect to the VM.

Again, the Docker Toolkit is set up to try and make things easy. If I install the toolkit I can run an app called Docker Quickstart Terminal:

And this will open a terminal where I can use these commands. It will also start the docker machine VM if it has to. It's even smart enough to recognise if I have multiple terminal apps, such as iTerm, and ask which one I want to use.

This problem is - this doesn't always work smoothly. Sometimes it will seem that the machine has started but will still not accept commands. Typically a restart is needed in this scenario.

Also, it's an interruption. If you are running a terminal already and want to issue a quick command, it will fail, unless it was a terminal started with the Docker Quickstart app.

3. inotify - In Container Development

If you recognise the term, you probably know the issue. If not, a little explanation is necessary.

As you get more and more familiar with Docker, you will probably find that you are spending more and more time testing, building then running your image in a container. In fact, you might be changing a single code file and using the container as the dev test server on your machine.

This fast gets painful - the container image takes time to build and slows down the development cycle. There's a great technique in this scenario: In Container Development.

In container development is pretty much what it sounds like. Instead of editing your code on your machine, building an image and creating a container to debug, you simply create the container with what you need, mount your code in to the container and run all of your development tooling from inside the container:

In this diagram, I have my code locally on my machine. I have built a container which runs nodemon, watching a directory on the container. That directory is actually just a volume containing my code which I have mounted into my container.

This is a really nice technique - I can still code locally, but as I make changes, nodemon serves up my new content.

This specific example applies to Node.js, but can be applied to many scenarios.

The problem is that many watcher tools like nodemon use a kernel subsystem called inotify3 to get notifications when files change. But inotify doesn't work on virtualbox4. This means that this technique isn't supported for Mac or Windows. There are however some tools which try and work around this with polling.

So now we have another issue. The develop/test process might be nice on Linux, but for devs on other platforms the process is more clunky.

The issues I've mentioned so far are the big ones which cause me problems personally, I'm sure there are others (please comment and let me know!).

This is why there was rather a lot of interest in the new Docker Beta - one of the big features is that the Docker Machine is going away. In theory, we can use Docker on a Mac or Windows and have the same experience as on Linux.

So how?

Virtualbox is gone. We still need a VM, but this VM is now a very lightweight Alpine Linux based image which runs on xhyve for MacOS and Hyper-V for Windows. All management of this VM is handled by the docker executable.

If these are not familiar terms, Alpine Linux is an extreeeemely lightweight Linux distro originally design to fit on a floppy disk (I think it clocks at around 5 MB now). xhyve is an extremely lightweight hypervisor which allows FreeBSD and some other distros on OSX. Hyper-V is a native hypervisor for Windows Server which can run on Windows 8 onwards5.

Using tools specifically designed for each platform (and with the help of both Apple and Microsoft), Docker have been able to make the experience much more seamless and smooth.

Removing the three pain points discussed and a clean and simple setup process is what I'm looking at today, and here's the results.

Docker Download Windows

Installation

Piece of cake. Download the beta, install, run, enter the beta key and pop, there's the new docker:

The new status bar icon gives me a way to quickly see the status of the machine. Some of the commands hint at features to come, others offer the instructions needed. Settings are fairly basic, but I'm not sure what else you'd need:

1. Localhost vs docker-machine IP

Quickly bashing out the commands below shows that the virtual machine IP address issue is gone:

Great news!

How this works under the hood is a mystery to me. If anyone knows, I'd be interested and would like to update this writeup!

2. Terminal Hassle

Quick and easy to test - running any terminal any way I like lets me access containers using the docker executable - no magic needed:

Here's a screenshot of iTerm3, the Terminal App and the Terminal App running zsh, all of which are happily communicating with the docker deamon through the docker app.

3. In Container Development

I've not thrashed this one too hard, but gone for a quick sanity check. Throwing together probably my best ever node.js app6:

main.js

and a simple dockerfile:

Dockerfile

is enough to test this. I can build then run the container, mounting the working directory into the src volume on the container:

Immediately, I open a new window and change the source code and save (on my local Mac, not in the container). Voila:

Live reloading works without a hitch! nodemon picks up my changes, using inotify from the VM (all through a lightweight userspace hypervisor).

You know what is cool7? I don't even need Node.js installed to build this Node app! The runtime is in the container, all of the execution happens in the container.

That's it for my initial impressions. From this point onwards I'm going to be using Docker for Mac heavily as I'll do all of my work with it installed, so from time to time I may update this article with other observations.

The key takeaway is: at the moment, Docker for Mac just works. I'm using it in the same way I would on Ubuntu with no messing around. This is great, it seems like a simple thing but I'm guessing it was a lot of effort from the guys and girls at Docker, Microsoft and Apple.

This is still a Beta, there'll be bugs and they'll be fixed. I can't wait for the Beta to go fully into the wild, and see what exciting things people can do with it.

Docker For Mac

As usual, any comments or observations are welcome!

References

Further Reading

Namespaces: http://man7.org/linux/man-pages/man7/namespaces.7.htmlcgroups: http://man7.org/linux/man-pages/man7/cgroups.7.htmlDocker Execution Drivers: https://blog.docker.com/2014/03/docker-0-9-introducing-execution-drivers-and-libcontainer/inotify: http://man7.org/linux/man-pages/man7/inotify.7.htmlThe challenges of in-container development on OSX: http://hharnisc.github.io/2015/09/16/developing-inside-docker-containers-with-osx.html

  1. Read up on namespaces here and cgroups here. Docker can also use LXC but no longer has to, there's a great write-up here. ↩︎

  2. Surprise! ↩︎

  3. Read up on inotify here↩︎

  4. The issue will not be resolved: https://www.virtualbox.org/ticket/10660↩︎

  5. I've not used the Docker for Windows Beta yet so have not got first hand experience of it. I've also not looked into compatibility, from memory Hyper-V isn't available on Home versions of Windows, but I might be wrong. ↩︎

  6. Inspired by my first programming book, the excellent C for Dummies by Dan Gookin. ↩︎

  7. For a given definition of cool. ↩︎