question

VipinViswanathan-8738 avatar image
0 Votes"
VipinViswanathan-8738 asked prmanhas-MSFT answered

Are containers independent of host OS?

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
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

1 Answer

prmanhas-MSFT avatar image
0 Votes"
prmanhas-MSFT answered

@VipinViswanathan-8738 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.



5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.