I recently learned that I could turn on experimentally features in Docker for Windows and run both Windows and Linux images simultaneously. Normally we need to switch between them, and you can run one or the other. The feature is here for some time now, but below is the 2021 short tutorial :).
1. Switch to Windows containers in Docker for Windows tray
2. Go to Docker Engine settings section and set experimental parameter to ‘true’
3. Apply and restart the docker
4. Run Windows nad Linux docker image
Let’s create a docker-compose file with 2 images:
- Windows Server Core with IIS (Windows container)
- SQL 2017 server (Linux container)
If you look carefully in the sql2017 section, you can see the parameter platform: linux. This specifies the platform on which you want to run the image. Save the file to dc-mixed.yml.
Now let’s run the docker-compose file and wait for the containers to download and run:
docker-compose -f .\dc-mixed.yml -p Demo up
And that’s it; you are now running both Windows and Linux containers on Docker for Windows. Please note that this is an experimental feature, but I use it for development/test purposes.
Till next time!