If you are running Sitecore in a container then you’ve most likely switched Docker desktop to Windows container mode. But what if you want to run a Linux container simultaneously? For example, you might want to fire up, JMeter and Grafana on Linux containers. It turns out this is possible in your local development environment and is fairly straightforward.
Enable Experimental Features
The experimental features are not ready for production. They are provided for test and evaluation in your sandbox environments. Before we enable let’s just do a quick check and make sure There are no containers currently running and if there are we’ll want to stop or shit them down.
docker container ls
Access the Docker Desktop Settings, select the Daemon tab and enable Experimental Features and hit Apply.
You should get a message indicating Docker Desktop is restarting.
Fire up your favorite Sitecore containers again to ensure they are still working as expected.
All good. Now let’s go ahead and pull down a Linux container for Grafana from Docker Hub
docker pull –platform=linux grafana/grafana
Notice I have specified the flag –platform=linux? Adding the –platform=linux flag allows the Linux container to be successfully pulled and run while running Docker in Windows Container mode.
Now we will fire up the container specifying with the –platform flag:
docker run –platform=linux -d –name=grafana -p 3000:3000 grafana/grafana
Lets check our running containers and you should see Grafana which is running in Linux:
We should be able to browse Grafana http://127.0.0.1:3000
What happens if you disable Experimental Features and try to run a Linux container while in Windows Container mode?
You should get an error indicating “–platform” is only supported on a Docker daemon with experimental features enabled.
If you remove –platform flag you will get an error response from daemon: operating system on which parent image was created is not windows.
- Docker Experimental Features
- docker-compose up is music to one’s Sitecore ear!
- Capture & Monitor JMeter metrics in real-time with InfluxDB & Grafana