Reputation: 515
Sorry if this is a silly question, but:
I came from vagrant where we have a full featured OS in each machine, where running ps -aux
we can see the OS processes and our services (I know to some extent the difference between applications running in VMs and Docker).
Then I've just built some containers using docker-compose and logged in into a container using bash (which is based on debian:jessie image). After running ps -aux
I can only see the services I installed, not a single OS's process. Why? Where they are? How this works?
Docker has a VM in which the containers run, each container may be based on a different distribution, so, is the OS containerized also, giving the fact the there's the host's OS (VM) for docker?
Upvotes: 2
Views: 1071
Reputation: 264956
Docker has a VM in which the containers run
Nope, containers are not VMs (docker includes a VM for desktop versions, but that isn't a container, and there are VM runtimes, but that's not a traditional container).
Containers are a way to isolate a running application with kernel namespaces for things like the filesystem, pids, and network. They all run in the same kernel. Pulling a base image for Alpine, Ubuntu, etc, gives you the base filesystem, libraries, package managers, but not the kernel. The only process launched inside a container is your application, and when your application exits, so does the container. Therefore you won't see OS utilities running.
See also this answer
Upvotes: 3