Karthik Shivkumar
Karthik Shivkumar

Reputation: 141

Docker - Does the container OS need to be same as Host OS

Can I have a Docker container having Linux OS running on my MAC machine? As far as my understanding goes, the only thing the Docker and the base OS share is the Kernel.

Upvotes: 0

Views: 2582

Answers (2)

philipp
philipp

Reputation: 16515

That is right, docker shares recourses with the host OS. If you want to run an Ubuntu based image on Mac, you will need to run a virtual machine with a linux, which in turn runs the container. Btw. on Mac docker uses docker-machine to run containers, what basically does all that for you.

So all in all docker is not »cross plattform«, if you want to run windows docker containers, you will a windows host, too.

Details: As described here, docker requires a linux kernel with a minimum version of 3.10. With that it can use cgroups (a kernel feature) to manage the recourses.

So the kernel of the host must have that feature. If not a virtual machine (virtual box, docker-machine) can be used to make that happen on nearly any OS, which is capable to run a VM. But keep in mind, that some features like Port forwarding (docker run -p 8000:80 …) will not work with a VM, if you type http://localhost:8000, since you need to change that to http://<ip of vm>:8000.

Upvotes: 0

herm
herm

Reputation: 16315

Docker does share resources with the host os. However the host is always a linus system, in case of mac OS there is a virtualized linux running dockerhttp://stackoverflow.com/questions/30632386/is-docker-a-solution-for-making-application-cross-platform

Upvotes: 2

Related Questions