Many of the images will be documented for which OS they are targeting on docker hub or in their documentation. For example mcr.microsoft.com/mssql/server
targets Linux so you'll need to run a Linux Containers environment (scroll to the Full Tag Listing section).
For a more programmatic solution you are able to inspect images to learn more about them from your shell if you've previously pulled them. For example if I inspect an IIS image like mcr.microsoft.com/windows/servercore/iis:windowsservercore-ltsc2019
we can see that it is built for Windows on amd64 cpu's.
You can inspect an image using docker image inspect
from the command line.
docker image inspect mcr.microsoft.com/windows/servercore/iis:windowsservercore-ltsc2019
The results will be a large json blob describing the images you inspected:
[
{
...I've left out a lot of other details here
"Architecture": "amd64",
"OS": "windows",
"OsVersion": "10.0.17763.973",
...
}
]
For an answer of what type of containers you should be running you'll want to look at the "OS" value - in my example that's "windows" so we'll need Windows Containers support and get an error if we try to deploy the container into a linux environment.
To simplify this command and prevent you having to dig through a json file you can include a --format
flag. For example:
docker image inspect mcr.microsoft.com/windows/servercore/iis:windowsservercore-ltsc2019 --format='{{json .Os}}'
In my example I included "OSVersion" as well, this is particularly important when considering compatibility of Windows containers with the host version of Windows. You can learn more about Windows Container Compatibility in the docs. This value is less important for linux based containers and may not be present in all images.