I recently started using Docker, but sometimes I don't understand the relationship between containers and the OS.
I understand that the Docker mechanism shares the kernel with the host OS, and the container isolates only what is needed to run the application.
However, if you look at the Docker image, images such as Ubuntu and CentOS are also distributed.
The following points are not well understood as to what these images distribute.
-If i put Docker on MacOS, pull the Ubuntu image and launch the container, what is the OS running in the container?
In the above example, if I want to install some libraries in the container, can you use a package management tool for MacOS such as homebrew?
・ As another example, if Docker is installed on MacOS and a container is launched by pulling an image (such as python) that is not an OS, what is the OS running in the container?
I think the expression "OS running in a container" is a little strange for myself ...
Answer # 1
-If you put Docker on MacOS, pull the Ubuntu image and launch the container, what is the OS running in the container?
Linux (various distributions)
If Docker is the same CPU of Linux, the format of the executable file written in machine language is the same in different distributions, and it will work if you pass an appropriate dependency library.
You can't do that because MacOS is Unix.
So when I installed an application called Docker for Mac,
Using paravirtualization technology, simple high-speed Linux is operated as a virtual machine behind the scenes, and Docker is used in the virtual machine.
・ In the above example, if you want to install some libraries in the container, can you use package management tools for MacOS such as homebrew?
Homebrew is impossible.
Because it is a story inside the Linux of a virtual machine ...
For example, if you dropped the CentOS image, a package management tool called yum,
If you have dropped an Ubuntu image, you can use a package management tool called apt.
They only differ in whether yum and apt are in the directory where the path has passed.
・ As another example, if Docker is installed on MacOS and a container is launched by pulling a non-OS image (such as python), what will be the OS running in the container? ?
Repeat, any Linux distribution is a candidate.
Recently, Debian (including Ubuntu) is strong.
If you are interested, please check the site called Docker Hub.
In particular, all the famous images that are officially distributed include the Dockerfile used at the time of the build,
It is written in the form of
FROM distribution nameon the top line of the Dockerfile.
On the other hand, do not use an image that does not disclose the Dockerfile.
Answer # 2
Ubuntu and CentOS have the same kernel but different commands.
So, the Ubuntu and CentOS images have been reconfigured just like the command set, using the Linux kernel of the running environment as it is.
Non-OS image (e.g. python)
also actually runs on the Linux operating environment.
Since neither MacOS nor Windows is Linux, dedicated Linux is prepared in a virtual environment.
Answer # 3
Docker is a tool that relies on the Linux kernel, so it can't bedirectlyrun on macOS.
When running Docker on macOS, a Linux virtual machine is started up and run in it.
And distributions may vary from container to container, but the container kernel is always the Linux kernel.
- mysql - about docker container startup error
- is it possible to deploy a container created with docker once on heroku and then migrate it to aws later?
- about the mechanism of docker
- i want to control the port of the container started with docker-compose with firewall
- docker container log aggregation method using fluentd
- ruby - about docker (error occurred suddenly)
- when i try to start a container with docker run, npm err! coming out
- mysql - [docker] container does not start
- mysql - [docker] error occurs in web container when docker-compose up in development environment
- ruby on rails - about rails db: seed when creating rails api in docker environment
- postgresql - communication to docker postgres container
- about docker
- why does the linux os seem to be running when i log in to a freshly created docker container without using the linux os image?
- ruby on rails - about rails db: seed in docker environment
- Docker implements cross-host container communication based on macvlan
- about when inputting postgresql initial data with docker
- about docker run -it options
- linux - about the environment in which the container operates
- ruby on rails - about developing with docker
- when building a docker container on circleci, it fails because it is told that the ruby version is different
- python 3x - typeerror: 'method' object is not subscriptable
- python - you may need to restart the kernel to use updated packages error
- xcode - pod install [!] no `podfile 'found in the project directory
- vuejs - [vuetify] unable to locate target [data-app] i want to unit test to avoid warning
- android studio - emulator: dsound: could not initialize about the error message directsoundcapture
- android studio - unresolved reference comes out in kotlin
- mysql startup failed [error] innodb: the innodb_system data file 'ibdata1' must be writable
- django - oserror: [winerror 123] the file name, directory name, or volume label syntax is incorrect : '<frozen importlib_boot
- python - importerror: cannot import name md5 error cannot be resolved