Earlier today I was talking with some of my coworkers about what I learned about Docker over the last three weeks, and it dawned on me that they did’t have Docker installed on their computers. My first reaction was to want to say, “Oh, it’s so easy!” While this is mostly true, I wanted to review the setups that I’m aware of to help anyone that wanted to use Docker at home. If you need Docker installed for your work environment, then you can use this as a starting point, but you will want more than I am going to write about today.
I can think of five broad scenarios that you might install Docker in:
- Docker on Linux
- Docker on Mac
- Docker on Windows Pro or better using Hyper-V
- Docker on Windows 10 2004 Pro or better using WSL2
- Running a virtual machine that runs one of the above scenarios
Docker on Linux
Most distributions of Linux offer a Docker package as part of their standard library. This makes the barrier to entry minimal if you use Linux. However, most distributions freeze their version of Docker at the version it is at when they make a release. Case in point, Ubuntu Xenial ofers 18.09.7, Ubuntu Focal provides Docker 19.03.8, while Docker has released 19.03.12 as of this writing. Please remember, however, that while the distribution packages are of older versions, the package maintainers do backport security updates into their software, so they normally are only lacking in new functionality.
If you want to be on the cutting edge (or even bleeding edge), you can visit the Docker Hub for Linux package repositories and add their latest release or beta versions to your package management software. This has the benefit of providing you with the latest version of Docker. However, if there is a problem, you will likely need to work with the Docker community and your distribution’s community to work through any issues you encounter.
Docker on Mac
Full disclosure: I have no idea; I don’t own a Mac. However, you can download a copy of Docker Desktop from the Docker Desktop download page. My guess is that it works like the Windows counterpart, but since OS X is a Unix flavor, you should not have any problems with using it. At least fewer problems than Windows users, anyway.
Docker on Windows Pro or better using Hyper-V
If you want to download Docker Desktop for Windows, you will need Windows Pro or better. This is because Docker Desktop requires the use of Hyper-V, Microsoft’s virtualization software, to create any Linux containers that you would want to run. This feature is not available in Windows Home. This will also allocate a chunk of RAM from your OS so the VM can breathe while running your containers. If you have 8GB or less of RAM, you will find that you need to manually start (and stop) Docker Desktop so that your other applications have enough RAM while you are not using it. However, it runs very reliably. I’ve read that Docker Desktop downloads a VM of Alpine Linux to run the actual Linux containers and that the Windows service acts as a bridge into that.
Docker on Windows 10 2004 using WSL2
This is extremely new; I actually opted into Microsoft’s beta program so I could get a copy of Windows 10 that runs WSL 2 back in December. Now that Win10 2004 is out, Windows 10 users can now get access to WSL2. What is WSL2? It is the Windows Subsystem for Linux version 2 a it allows you to run native Linux binaries on Windows. No joke. It works great. I’ve been using WSL at work now for over a year to get access to common Linux packages like grep and openssl without needing to hunt down a Windows port of the programs. WSL2 allows for tighter integration, and Docker Desktop is able to leverage those new features to use the Linux software you install on Windows to run Docker. On any version of Windows 10 later than 1607, I believe you can go to the Windows Store and download a copy of Ubuntu, SUSE, Cali, and Debian Linux. Unlike Hyper-V, WSL2 is available to all version of Windows 10, according to Microsoft.
There’s a couple tricks to getting WSL2 working on your computer if it meets the requirements. I found this excellent guide by Scott Hanselman and Microsoft’s WSL2 installation instructions. Do the Dew and get WSL2 installed on your computer, and you’re ready to run native Linux containers on Windows. Back in January, I also tried to launch the Kubernetes on Docker option, which crashed Docker royally. When I tried again at the start of June, it ran flawlessly. I was also able to run kind to install multiple Kubernetes nodes as containers on my Docker Desktop.
Running a virtual machine that runs one of the above scenarios
If you are still running an older version of Windows or have a virtual environment, you can spin up a VM running Linux or Windows Server and run Docker on that. It is just a little more effort, because you need to install and maintain yet another OS. I recommend using a Linux distribution that you can find a lot of help with for Docker if you have to go this route, if you’re not familiar with Docker or Linux. (Truth: Linux is getting easier to use, but is still not meant for people that swear by Computers For Dummies.) On Windows, you will likely want to download a copy of VirtualBox from Oracle and will need to make sure that you have enabled virtualization in your BIOS. If you need help, you will need to search for specific directions on how to do this, as it varies widely from manufacturer to manufacturer.
Other tools you will need
This is strange to say, but you only need whatever tools you currently use to write software or configure computers. Except maybe a solid text editor to edit your Dockerfiles and other config files. I like Notepad++, and others at work swear by TextPad. If you’re running Linux or OS X, you also have the software available on those systems. Scott Hanselman can show you how to get VSCode setup so you can develop in your Windows containers. But the reality is that you will still likely to continue to use the tools you already do. Until you figure out how to get a container to do it for you.
What else do I need for my work environment?
Leveraging containers is more than just installing Docker. It is providing a container infrastructure that can run those containers in production. It is adopting new resources to store images for team and enterprise use and potentially adopting or adjusting new change control processes. You need to consider high availability and backup. So if you want to start using Docker at work but your work has not picked up on it, your use will be severely limited to development you do, and then you will need to get it out of the container to use the way your work currently does. Based on what I’m seeing what my work, this needs to be a business level decision with buy-in at all levels: management to get the shiny new toys to run the containers and the okay to move to that architecture, devs to learn “the new way to do the old thing”, ops to figure out and implement the architecture needed to reliably run the containers, and your customers’ patience as you grow into this, because the change will initially slow you and your projects down as you start learning and doing. Don’t worry, you’ll get faster than before when the change is done. Making containers work right, like most things in life, ends up being a team effort.