Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Are Docker containers tied to the underlying host OS?

Tags:

docker

As a newbie,I have read the official Docker documentation, and have followed many explanations here, tutorials, videos on this, but have not yet got a clear answer to my question. If a docker container must use the underlying host OS kernel, then how can they claim "build, ship and run anywhere"? I mean, linux-based containers can run only on linux-based host OS machines, and similarly with windows containers. Is this correct, or have I completely missed it? I am not sure there is such a thing as "linux-based containers" and "windows-based containers".

I can see when someone claims that java apps can run on any OS, but dont see how the same claim can be made for docker containers.

like image 392
Satya Rao Avatar asked May 10 '17 17:05

Satya Rao


2 Answers

Containers isolate applications from each other on the same machine, but you're right, they all use the underlying OS. If you need different OS to run different applications on the same machine, you need to use virtual machines instead. Containers are good because you get everything you need to run an application in a single package, and there's less waste of resources because you're not throwing a whole big OS in there as well.

Note that for development purposes it's not unusual to run containers inside a virtual machine, so for instance you can run a linux vm on your pc/mac, and easily move the containers you develop there into real linux-based production.

Check out the snappy FAQ explanation here: https://docs.docker.com/engine/faq/#how-much-does-engine-cost

like image 135
George M Reinstate Monica Avatar answered Oct 15 '22 12:10

George M Reinstate Monica


Short answer: Correct. All containers share the same linux kernel. If you depend on a kernel specific features, Docker is not for you. Beside that, there are also Windows based images and theoretically you can bring any host kernel as long as it fulfills the requirements of these guys: https://www.opencontainers.org/

like image 3
CFrei Avatar answered Oct 15 '22 14:10

CFrei