With docker it seems like it's possible to run multiple OS's on the same machine for example
docker run -it ubuntu:latest
root@09e498dae658:/#
docker run -it centos:latest
[root@8216b5141efc /]#
The docker docs state that the Linux Kernel comes from the host running the linux container. So for the above command I get same output when I run cat /proc/version
docker run -it ubuntu:latest
root@09e498dae658:/# cat /proc/version
Linux version 4.9.87-linuxkit-aufs (root@95fa5ec30613) (gcc version 6.4.0 (Alpine 6.4.0) ) #1 SMP Wed Mar 14 15:12:16 UTC 2018
docker run -it centos:latest
[root@8216b5141efc /]# cat /proc/version
Linux version 4.9.87-linuxkit-aufs (root@95fa5ec30613) (gcc version 6.4.0 (Alpine 6.4.0) ) #1 SMP Wed Mar 14 15:12:16 UTC 2018
Since the Kernel is the same same regardless of what image is used it seems quite wrong to think of docker as being able to run multiple OS's on the same machine. Some questions.
When executing docker run -it ubuntu:latest
what parts of ubuntu are there and what parts are missing? Can it be considered Ubuntu?
If the Kernel is the same regardless of what images are used what's the point of actually using a specific os container image like ubuntu:latest
or centos:latest
?
Is there a mechanism/process used to ensure that the os packages are compatible with the Kernel used the docker host?
Is it a best practice to run a container image on a kernel of the same type for example run ubuntu:latest on host that has the same version of ubuntu as the container image?
The official Ubuntu Docker image is the most downloaded image from Docker Hub. With over one billion downloads, Ubuntu has proven itself to be a popular and reliable base image on which to build your own custom Docker images.
Images are built from a model assertion using ubuntu-image, a tool to generate a bootable image. It can be installed on a snap-supporting Linux system as follows: $ sudo snap install ubuntu-image --classic. The ubuntu-image command needs only the filename of the model assertion to build an image.
If you app is compiled to run on Linux, it relies on Linux libraries (libc, glib, and so on) that must be present in executing environment, regardless of its type. Docker makes no exception to this. So a Ubuntu application requires a Ubuntu image in order to run correctly.
A Docker image is a file used to execute code in a Docker container. Docker images act as a set of instructions to build a Docker container, like a template. Docker images also act as the starting point when using Docker. An image is comparable to a snapshot in virtual machine (VM) environments.
You're right, the kernel will be the same. However, the distro is the collection of software included with the kernel, so when running centos vs ubuntu in a container, you're just getting access to whatever packages are included with ubuntu. The most apparent difference to me would be the default package manager (yum vs apt).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With