A common developer workflow when using frameworks like Symfony or React is to edit the source code using a Windows IDE while running the app itself in a Docker container. The source is shared between the host and the container with a command like the following:
- Docker Windows Desktop Tutorial
- Docker Windows Desktop Setting
- Docker Windows Desktop
- Docker Windows Desktop Container
- That's the prerequisite starter for Docker Desktop covered, so now lets get to the main course! Installing Docker Desktop for Windows 1. Download and Install. Head to the Docker Desktop website and download the Installer for Windows. This is a hefty 500MB, but once it's finished, run the installer.
- Getting Docker Desktop for Windows. Docker Desktop for Windows is free to download. If you don't understand something about Docker Desktop for Windows, the extensive documentation is a great place to look for answers. Support for Docker Desktop is available to Docker customers on a Pro or Team plan by completing the.
- The fastest and easiest way to get started with Docker on Mac.
$ docker run -v C:Usersme:/code -p 8080:8080 my-symfony-app
Docker for Mac (Docker Desktop) Docker for Mac requires that you’re running Mojave 10.14+ or newer with an Intel CPU. M1 support is on its way. You can run VirtualBox 6+ alongside Docker Desktop. This is pretty useful because you might have some legacy apps running in Vagrant / VirtualBox to deal with (I know I do!). Docker for Windows.
This allows the developer to edit the source code, save the changes and immediately see the results in their browser. This is where file sharing performance becomes critical.
The latest Edge release of Docker Desktop for Windows 2.1.7.0 has a completely new filesharing implementation using Filesystem in Userspace (FUSE) instead of Samba which:
- uses caching to (for example) reduce page load time in Symfony by up to 60%;
- supports Linux inotify events, triggering automatic recompilation / reload when the source code is changed;
- is independent of how you authenticate to Windows: smartcard, Azure AD are all fine;
- always works irrespective of whether your VPN is connected or disconnected;
- reduces the amount of code running as Administrator.
Your feedback needed!
This improvement is available today in the Edge 2.1.7.0 release and will roll-out to the stable channel later once we’ve had enough positive feedback. Please download it, give it a try and let us know how it goes. If you discover any problems, please report them on GitHub and make sure you fill descriptions and reproduction steps so that we can quickly investigate.
Big performance improvements
Performance is vital when application source code is being shared between the host and a container. For example when a developer uses the Symfony PHP framework, edits the source code and then reloads the page in the browser, the web-server in the container must re-read many PHP files stored on the host. This must be fast.
The following graph shows the time taken to load a page of a simple symfony demo in three configurations:
- Previous version: this is the implementation in earlier versions of Docker Desktop
- Docker Desktop Edge 2.1.7.0: this is the new (faster!) implementation
- In-container: the files are not shared from the host at all, instead they are stored in the container to show the upper limit on possible future performance.
The two bars on the left hand side show the latency (in seconds) using an older version of Docker Desktop. Note that the second fetch is only slightly better than the first, suggesting that the effect of caching is small.
The two bars on the right hand side show the latency when the files are not shared at all, but are stored entirely inside the VM. This is the upper limit on performance if the volume sharing system were perfect and had zero overheads.
The two bars in the middle show the latency when the files are shared with the new system in Docker Desktop Edge 2.1.7.0. The initial (uncached) fetch is already better than with the previous Desktop version, but the second (cached) fetch is 60% faster!
Additional enhancements
As well as big performance improvements, the new implementation has the following additional benefits:
- The new version can’t conflict with organisation-wide security policies as we don’t need to use Administrator privileges to share the drive and create a firewall exception for port 445.
- The new version doesn’t require the user to enter their domain credentials. Not only is this fundamentally more secure, but it avoids the user having to re-enter their credentials every time they change their password. Many organisations require regular password changes, which means the user needed to refresh the credentials frequently.
- The new version supports users who authenticate via a smartcard, or AzureAD or any other method. Previously we could only support users who login with a username and password.
- The new version is immune to a class of problems caused by enterprise VPN clients and endpoint security software clashing with the Hyper-V network adapter.
Stay tuned for a follow up post that deep dives into the new Docker Desktop filesharing implementation using FUSE.
If you're running macOS or Windows you have a few options for installing Docker. There's even a third way too, and we'll compare them here.
Quick Jump: OS and Hardware Requirements|Pros and Cons|Which One Should I Use?
If you’re on macOS or Windows you can install Docker with:
- Docker for Mac / Windows (now known as Docker Desktop)
- Docker Toolbox
- Running your own Virtual Machine and installing Docker yourself
Docker Windows Desktop Tutorial
All 3 of those options have their own pros and cons and in this article we’re going to cover them. If you’re looking for a high level overview of what Docker for Mac / Windows and Docker Toolbox is, then check out this article on getting to know Docker’s ecosystem.
OS and Hardware Requirements
It’s helpful to know what you can install before we compare everything, so let’s do that:
Docker for Mac (Docker Desktop)
Docker for Mac requires that you’re running Mojave 10.14+ or newer with an Intel CPU. M1 support is on its way.
You can run VirtualBox 6+ alongside Docker Desktop. This is pretty useful because you might have some legacy apps running in Vagrant / VirtualBox to deal with (I know I do!).
Docker for Windows (Docker Desktop)
As of May 27th 2020, Microsoft released Windows 10 build 2004 (Spring 2020) that allows you to run Docker Deskop on all editions of Windows 10, including Home thanks to WSL 2.
As of August 2020, Microsoft enabled WSL 2 support for Windows 10 builds 1903 + 1909.
For years prior to that you could only run it on Windows Pro, Enterprise or any edition that had Hyper-V available, but since August 2020 pretty much all supported versions of Windows 10 can use Docker Desktop.
You can also run VirtualBox 6+ alongside Docker Desktop too in case you have older projects using VirtualBox (perhaps with Vagrant too).
Docker Toolbox
Prior to mid-2020 this was still a reasonable way to run Docker on machines that couldn’t run Docker Desktop, but that’s no longer the case.
It’s now considered legacy and as of late 2020 it’s been officially deprecated.
Unless you’re using unsupported versions of Windows or have a really really ancient Mac you shouldn’t need to ever use this tool.
But if you’re in a pinch and you absolutely must use it, technically it’s still available at https://github.com/docker/toolbox/releases, but it’s no longer maintained by Docker.
Your own Virtual Machine
Docker will happily run inside of VirtualBox, VMWare Workstation or any other Type 1 / 2 Hypervisor that’s running a major distribution of Linux as a guest OS.
If for whatever reason you can’t use Docker Desktop then this solution would be better than using Docker Toolbox since you can install supported versions of Docker and you have full control over the environment.
Pros and Cons
Now for the good stuff!
Docker for Mac / Docker for Windows (Docker Desktop)
Pros
Offers the most “native” experience, you can easily use any terminal you you want since Docker is effectively running on
localhost
from macOS / Windows’ POV.Docker is heavily developing and polishing this solution.
Docker Windows Desktop Setting
Cons
On certain macOS hardware combos the volume performance can be a little slow.
I can legit say there are not any “wow this sucks!” cons for Windows, it’s really solid.
Docker Toolbox
Pros
- Offers an “out of the box” Docker experience if you have no other choice.
Cons
It’s deprecated by Docker and will receive no future maintenance.
You need to either use the Docker Quickstart Terminal, or configure your own terminal to connect to the Docker Daemon running a VM.
Not a native solution, so you’ll need to access your Docker Machine’s IP address if you’re developing web apps. Example:
192.168.99.100
instead oflocalhost
.Unless you jump through hoops, your code needs to live in your Windows user directory such as
C:UsersNicksrcmyapp
. Otherwise Docker won’t be able to find it.Suffers from typical VirtualBox edge case bugs and mount performance issues.
Your own Virtual Machine
I’m not going to bother listing a pros and cons here because I wouldn’t recommend doing this UNLESS you’re stuck on Windows 7 / 8 or an older version of Windows 10 like 1809.
But more on that in a bit.
Which One Should I Use?
If you’re interested in Docker, you’re a smart person and you probably came to the conclusion that using Docker for Mac or Docker for Windows is a good idea as long as you can run it.
My recommendation would be to try Docker for Mac / Windows first, and test it against your actual use cases. The performance issues may or may not be a concern, especially since everyone’s needs and computer specs are different.
I’ve been using Docker Desktop on Windows for full time development since late 2018 and it’s been nothing short of fantastic. Currently I use it with WSL 2, but it was really good with WSL 1 along with Hyper-V too.
Docker Windows Desktop
Stuck on an Old Version of Windows and Like Linux?
I want to mention a “roll your own VM” solution for Windows users because I feel like there’s an even better way to run Docker on Windows if you also like Linux and are stuck not being able to use modern versions of Windows 10.
It involves running VMWare Player in a special mode called “Unity mode”. This basically allows you to run Windows and Linux together seamlessly as 1 operating system.
There’s no dual booting and Linux applications (even graphical apps) run in their own floating windows. Then you can install Docker natively on Linux inside of the VM.
The performance is excellent and the entire set up is free too.
I used this set up for about 5 years until Docker Desktop was available. It gives you the best of both worlds. For example, I run high end audio / video apps on Windows while recording courses and screencasts that cover Linux content. It all works great (even for full time development).
You can watch a video guide and see screenshots on how to do that in this post on creating an awesome Linux development environment in Windows.
Docker Windows Desktop Container
Are you using the Docker Toolbox, Docker for Mac / Windows or your own VM?