foreword
When installing docker, the official website has two types : docker desktop and docker engine . What is the difference between the two? Which should be installed?
docker engine vs docker desktop
- docker desktop includes a virtual machine, a graphical interface, and other features such as a single-node kubernetes cluster, and a Docker CE (Docker Community Edition) daemon in the virtual machine.
- docker engine, according to the official document , contains three parts,
- daemon process
dockerd
- api, the program can interact with dockerd through api
- Command line tool client
docker
, command docker in docker command
- daemon process
In docker desktop, the docker client is in the host machine, and the daemon process is in the virtual machine. When you want to access the ip of docker desktop, keep in mind one thing - the docker network exists in the virtual machine , even if you use docker run --net host
it, you use the host network of the virtual machine, not the network of the physical machine. The docker container runs in a virtual machine, everything else is the result.
In Windows and MacOS, if you want to run a linux container, you must have a virtual machine, which is not required in linux; however, for a consistent experience, if you install desktop in linux, a virtual machine will also be installed.
The official docs describe Docker Engine like this
Docker Engine is an open source containerization technology for building and containerizing your applications. Docker Engine acts as a client-server application with:
A server with a long-running daemon process dockerd.
APIs which specify interfaces that programs can use to talk to and instruct the Docker daemon.
A command line interface (CLI) client docker.
The docker forum description of docker desktop.
Basically Docker Desktop is a virtual machine + Graphical user interface with some extra features like the new extensions and running a single-node Kubernetes “cluster” easily. Inside the virtual machine there is Docker CE (Docker Community Edition) daemon.
The docker desktop component mentioned in the official documentation .
in conclusion
- If it is installed on a desktop computer with graphics such as macOS, windows, linux, etc., use docker desktop. Such as windows computer, macos computer, ubuntu, fedora computer.
- If it is installed on a computer without graphics, use docker engine, such as the company's centos server, Alibaba Cloud's centos server, etc.
Install docker engine
Refer to the official documents below
- Install yum-utils (provides yum-config-manager) and set up the repository
sudo yum install -y yum-utils
sudo yum-config-manager \
--add-repo \
https://download.docker.com/linux/centos/docker-ce.repo
- List and sort the versions available in the repository
yum list docker-ce --showduplicates | sort -r
docker-ce.x86_64 3:18.09.1-3.el7 docker-ce-stable
docker-ce.x86_64 3:18.09.0-3.el7 docker-ce-stable
docker-ce.x86_64 18.06.1.ce-3.el7 docker-ce-stable
docker-ce.x86_64 18.06.0.ce-3.el7 docker-ce-stable
- Install the specified version, the version number is the second column, after the beginning of the colon until the first hyphen, such as in the first line
docker-ce-18.09.1
sudo yum install docker-ce-<VERSION_STRING> docker-ce-cli-<VERSION_STRING> containerd.io docker-compose-plugin
- start docker
sudo systemctl start docker
- Test the docker engine, this command will download a test image, print a line of text after the container starts, and then exit
sudo docker run hello-world
[root@root ~]# sudo docker run hello-world
Hello from Docker!
This message shows that your installation appears to be working correctly.
To generate this message, Docker took the following steps:
1. The Docker client contacted the Docker daemon.
2. The Docker daemon pulled the "hello-world" image from the Docker Hub.
(amd64)
3. The Docker daemon created a new container from that image which runs the
executable that produces the output you are currently reading.
4. The Docker daemon streamed that output to the Docker client, which sent it
to your terminal.