As the IT industry has increasingly started embracing containerization, it has become a cornerstone of modern software development. Sitecore is not an exception. Sitecore announced official support for containers from the version 10 initial release. Since then all of us have started using Docker Desktop to run Sitecore’s containerized solution.
If you are new to Docker and Containers, You can go through Bootcamp on Docker by my friend Eric Sanner.
But Docker Desktop is paid for commercial use. As I do not use its GUI much except for some nominal work, I thought of looking for its alternatives. Surprisingly, I learned that running Containers without Docker Desktop is possible.
This is roughly the composition of Docker Desktop. Under the hood, it utilizes Docker Engine. Additionally, it provides a decent Graphical interface to interact with Docker Engine.
It is good to have but not a necessity. All you need is a Docker Engine.
It is an open-source containerization technology for building and containerizing your applications.
Let us set up a Docker Engine on your machine to run Windows Containers.
Note : Though this article specifically targets Sitecore Containers, This Docker Engine setup process should be common for all those who wish to run Windows Containers.
There are a few really helpful articles about how to do it. Thank you for giving me a head start !!
- Jeremy Davis – Docker without the desktop (jermdavis.dev)
- Declaring Independence from Docker Desktop with Docker Engine | georgechang.io
Unfortunately, I already had Docker Desktop installed so I landed into a few issues. While fixing those I realized that it is better to pristine my machine. If you don’t, you may face weird issues due to unremoved files of the Docker Desktop.
Now let’s start with the action !!
Disclaimer – This will remove all your containers and images but eventually it will be downloaded when you run your instance.
- Uninstall ‘Docker Desktop’ from your machine
- You can try running ‘docker version’ after uninstallation which should throw an error saying ‘docker is not recognized’
- Even after uninstallation, a few files remain buried in your drive. Let’s remove them if present at the following locations. (If you face problem while deleting files, especially windowsfilter folder inside docker, do check this blog. If at worst nothing works, you can rename it like adding a ‘-old’ suffix, although it is not advisable.)
- C:\Program Files\docker
- Uninstall ‘Docker Desktop’ from your machine
Once this clean-up is done, we will be ready to set up the Docker Engine. (Here is a link to scripts to automatically execute all below steps.)-
Setup Docker Engine
- You need to download latest Docker Engine binary from here.
- Extract it and register Docker Daemon as a Windows Service with this command
- dockerd –register-service (Note : there are two consecutive hyphens before register)
- Add this path in Environment Variables
- This bridges a gap between OS and Docker Daemon. Now you can run commands anywhere in your machine.
- Test command – docker version
Your Docker Engine should be setup now. (Since we are focusing on Sitecore, we will setup Engine to support only Windows containers)
Install Docker Compose Plugin
- It is a tool for defining and running multi-container Docker applications.
- Download the latest .exe from this archive
- Rename it to docker-compose.exe
- Place it in C:\Program Files\Docker\cli-plugins
- Test command – docker-compose version
Set Rights for Current user
- This can be an optional step if the logged-in user has Admin Rights. Personally, I did this to rule out any future rights-related issues.
Once this is all done, there is no harm to restart 😉 And finally, you should be ready to spin up containers.
But wait, it’s not over yet. I have a surprise for GUI lovers. You still have few alternatives,
- Use the Containers window in Visual Studio
- It provides you a handy way to monitor Containers in Visual Studio. Check more details here
- It is available in Visual Studio 2022 or Visual Studio 2019 version 16.4 or later
- Make sure to run VS as admin, otherwise, you may see this error – Docker Desktop is not running. Please start Docker Desktop and try again.
- Docker in Visual Studio Code
- A very similar extension for VS Code from Microsoft. Check more details here
And CLI lovers, here is a docker cheat sheet from Sitecore for you.
I am working on compiling the below information. Stay tuned!
- Troubleshooting guide for bugs faced while setting up Docker Engine
- Docker Engine update scripts
That’s all for now! You are all set to work on your containerized Sitecore solution without Docker Desktop now.