Are containers independent of host OS?

Vipin Viswanathan 41 Reputation points
2021-04-27T09:23:35.95+00:00

Can I run a container that runs in Ubuntu (say, an application in Snap), in windows by installing snap?
Can I install the snap store in Windows 10?

Tutorials say containers are platform-independent but don't give an example. A container contains an application and its related dependencies, but usually, these dependencies are OS related. I don't think Windows DLL files can run on Linux and vice versa. So, it is hard for me to imagine it is a host platform-independent.

Thanks for your time and reply.

Azure Container Instances
Azure Container Instances
An Azure service that provides customers with a serverless container experience.
757 questions
0 comments No comments
{count} votes

Accepted answer
  1. prmanhas-MSFT 17,946 Reputation points Microsoft Employee Moderator
    2021-04-28T09:14:41.617+00:00

    @Vipin Viswanathan Apologies for the delay in response and all the inconvenience caused because of the issue.

    A container virtualises the underlying OS and causes the containerised app to perceive that it has the OS—including CPU, memory, file storage and network connections—all to itself. Because the differences in underlying OS and infrastructure are abstracted, as long as the base image is consistent, the container can be deployed and run anywhere. For developers, this is incredibly attractive.

    Since containers share the host OS, they do not need to boot an OS or load libraries. This enables containers to be much more efficient and lightweight. Containerised applications can start in seconds and many more instances of the application can fit onto the machine as compared to a VM scenario. The shared OS approach has the added benefit of reduced overhead when it comes to maintenance, such as patching and updates.

    Though containers are portable, they are constrained to the operating system they are defined for. For example, a container for Linux cannot run on Windows and vice versa.

    Same has been mentioned here and this is as per your understanding which you mentioned in your query.
    You can refer to below articles for more information around switching between Linux and Windows containers:

    https://docs.docker.com/docker-for-windows/#switch-between-windows-and-linux-containers

    https://www.docker.com/blog/preview-linux-containers-on-windows/

    Hope it helps!!!

    Please "Accept as Answer" if it helped so it can help others in community looking for help on similar topics.

    1 person found this answer helpful.
    0 comments No comments

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.