Jose Gabrielle Rivera
jgrivera.dev

jgrivera.dev

Letting go of Docker Desktop in Windows

Photo by Abigail Lynn on Unsplash

Letting go of Docker Desktop in Windows

It is not the only way to get Docker.

Jose Gabrielle Rivera's photo
Jose Gabrielle Rivera
·Jul 4, 2022·

3 min read

Table of contents

  • Foreword
  • Understanding Docker Desktop
  • Letting go
  • Trade-offs
  • Closing Thoughts

Foreword

A few weeks ago I updated my Docker Desktop to the latest version. Upon updating, it experienced another breaking bug and I was not able to use it. Docker Desktop has a lot of issues in Windows, like seriously. I could try a bunch of band-aid solutions but I wanted a permanent fix. So, I was curious whether Docker Desktop can be uninstalled from my Windows machine.

Understanding Docker Desktop

According to this article, Docker Desktop provides a compatibility layer, using a Linux VM, so that Docker can work on Windows and Mac. It is worth noting that Docker can only run natively on Linux, hence the need for the VM. Docker Desktop takes care of host OS integration tasks such as accessing the host's filesystem and networking.

Letting go

It is quite easy to remove Docker Desktop from Windows and Mac. Just simply uninstall it like any regular application. Uninstalling Docker Desktop will delete all of your Docker images and volumes. The images should be fine since you can typically just rebuild them again. The volumes might be a concern however.

Installing Docker (again)

In Windows, another approach is to directly install Docker is through the Windows Subsystem Linux 2 or WSL2. This allows you to avoid installing Docker Desktop completely.

Ubuntu can be installed in Windows through WSL2. After installing Ubuntu, you can follow the Linux installation instructions from the official documentation and have Docker running on WSL2.

Container management tools

There are some alternative tools that can be used for managing your containers without Docker Desktop.

Portainer

A good candidate to replace Docker Desktop is running Portainer using Docker itself. According to its documentation, you can simply run it as a container after setting up the portainer_data volume. You can execute the command below in WSL2:

docker run -d -p 8000:8000 -p 9443:9443 --name portainer \
    --restart=always \
    -v /var/run/docker.sock:/var/run/docker.sock \
    -v portainer_data:/data \
    portainer/portainer-ce:2.9.3

Using the command, Docker will always restart Portainer when the Docker engine starts. Think of Portainer as a web-based container management interface accessible using port 9443. It has all of the important tasks for managing your containers. It does not have all the bells and whistles that Docker Desktop offers though.

Docker CLI

To be frank, the Docker CLI commands can be enough on their own. For instance, the docker ps command provides information to currently running containers. Moreover, run, build, start, stop, kill, and rm are some of the common commands you can use for container management directly in the CLI. Check out the official documentation for a complete list of commands.

Trade-offs

When getting rid of Docker Desktop and relying on a WSL2-only Docker installation, the host OS integration is most significant loss. If you were to type docker in the Windows Command Prompt or PowerShell, it would be unrecognized. You would not be able to mount the Windows filesystem in this setup.

Regardless, Docker prefers a Linux filesystem and incurs performance drawbacks when mounting a Windows filesystem. Alternatively, you can setup your workspace inside WSL2 and you can mount the Linux filesystem there seamlessly. Luckily, Microsoft VS Code offers great support with opening workspaces inside WSL2. They also offer a Remote - Containers extension that enables a ton more of container features.

Closing Thoughts

A WSL2-only Docker setup feels more lightweight. I actually do not need to work with my Windows filesystem when doing Docker-related tasks. It is acceptable for me to let go of Docker Desktop. There might come a time when the host OS integration features become available even without Docker Desktop.

The more committed version of this setup is running Linux as your native OS. Running a native Linux environment offers a more delightful experience in using Docker. I am looking forward to experience that soon in the future. For now, it was quite fun to check the alternatives in setting up Docker on Windows.

 
Share this