Based on your needs, you can install the Docker Engine in different ways:
Before you install Docker on the newly installed machine, you need to set up the Docker repository. After the warehouse is set up, you can install and update Docker from the set warehouse.
Install the yum-utils
package (this installation package will provide the yum-config-manager
tool) and set up a stable repository.
$ sudo yum install -y yum-utils
$ sudo yum-config-manager \
- - add-repo \
https://download.docker.com/linux/centos/docker-ce.repo
Optional: Enable nightly or test repository.
The above repositories containdocker.repo
files, but they are disabled by default. You can enable them the same as the stable version repository address. The following content shows the command to enable the nightly repository.
$ sudo yum-config-manager --enable docker-ce-nightly
To enable the test (test) repository, please use the following command:
$ sudo yum-config-manager --enable docker-ce-test
You can disable the nightly or test repository by running theyum-config-manager
command and adding the--disable
flag after the command.
The following command means to disable the nightly repository:
$ sudo yum-config-manager --disable docker-ce-nightly
Learn more about nightly and test channels. .
Install the newest version of the Docker engine and container, or use the following steps to specify a specific version for the installation: $ sudo yum install docker-ce docker-ce-cli containerd.io
If you are prompted to verify the GPG Key when you follow it, please make sure that the fingerprint is consistent with the character string 060A 61C5 1B55 8A7F 742B 77AA C52F EB6B 621E 9F35
, and then select Accept.
Got multiple Docker repositories?
If you have multiple Docker repositories enabled, when using the yum install
or yum update
command to install and upgrade Docker, if you do not specify the version,
Then the above command will try to install using the latest version. This may cause the installed version to be not what you need.
Docker is installed, but not started. This is because the docker
group has been created, but no users have been added to the group.
For Docker installation specify version of the Docker Engine (Docker Engine), list the Docker versions available in a given warehouse, and then select the required version to install: a. List the Docker versions available in your warehouse by category. The following example lists the results of classification by version, from high to low:
$ 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
The above list is to specify the version of your CentOS operating system based on the repository you enable (as shown above, use the suffix el7
to mark).
b. Install the specified version of the Dock engine by providing the complete package name. The full path includes the package name (docker-ce
) and the version string provided in the second column.
The calculation starts from the character after the first colon (:
) and ends with the character before the separator (-
).
For example: docker-ce-18.09.1
.
$ sudo yum install docker-ce-<VERSION_STRING> docker-ce-cli-<VERSION_STRING> containerd.io
Docker is installed, but not started. This is because the docker
group has been created, but no users have been added to the group.
Start Docker $ sudo systemctl start docker
Run the hello-world
image (image) to confirm that the Docker installation is successful. $ sudo docker run hello-world
This command will download a test image and run it in the container. If the container is running, this command will print out some information and exit.
The Docker engine has been installed and running, you need to use sudo
to run Docker commands. Please continue to read the page [Linux 安装 Docker 的后续步骤](Linux 安装 Docker 的后续步骤)
To allow users without permission in your operating system to allow Docker commands and other configuration options.
If you want to apply for the Docker engine, please follow the steps of Install using warehouse to select the new version you want to install.
The result of the installation on the operating system.
All complete commands executed:
sudo yum install -y yum-utils
sudo yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
sudo yum install docker-ce docker-ce-cli containerd.io
sudo systemctl start docker
sudo docker run hello-world
https://www.ossez.com/t/docker-centos/717#install-using-the-repository
Recommended Posts