How to install docker ce

王林
Release: 2020-04-05 09:40:08
Original
1987 people have browsed it

How to install docker ce

This article explains how to install Docker CE on CentOS.

1. Operating system requirements

To install Docker CE, you need the 64-bit version of CentOS 7.

2. Uninstall the old version

The earlier version of Docker is called docker or docker-engine. If these versions are installed, uninstall them and their associated dependencies.

$ sudo yum remove docker \
                  docker-common \
                  docker-selinux \
                  docker-engine
Copy after login

3. Set up the mirror warehouse

3.1. Install the required software packages. yum-utils provides the yum-config-manager utility, and the devicemapper storage driver requires device-mapper-persistent-data and lvm2.

$ sudo yum install -y yum-utils device-mapper-persistent-data lvm2
Copy after login

3.2. Use the following command to set up the stable image warehouse. You always need to use the stable repository, even if you also need to install the build through an edge or testing repository.

$ sudo yum-config-manager \
--add-repo \
https://download.docker.com/linux/centos/docker-ce.repo
Copy after login

3.3. Optional: Enable edge and testing mirror repositories. These repositories are included in the docker.repo file above, but are disabled by default. You can enable them together with the stable registry.

$ sudo yum-config-manager --enable docker-ce-edge
$ sudo yum-config-manager --enable docker-ce-testing
Copy after login

3.4. You can disable the edge or testing mirror repository by running the yum-config-manager command with the –disable flag. To re-enable it, use the –enable flag. The following command is used to disable the edge registry.

$ sudo yum-config-manager --disable docker-ce-edge
Copy after login

4. Install Docker CE

4.1. yum software package index.

$ sudo yum makecache fast
Copy after login

4.2. Install the latest version of Docker CE, or go to the next step to install a specific version.

$ sudo yum install docker-ce
Copy after login

4.3. In a production system, you should install a specific version of Docker CE instead of always using the latest version. List available versions. This example uses the sort -r command to sort the results by version number (highest to lowest) and has been truncated.

$ yum list docker-ce.x86_64  --showduplicates | sort -r
 docker-ce.x86_64  17.06.0.el7        docker-ce-stable
Copy after login

The contents of this list depend on which registries are enabled, and will be specific to your CentOS version (in this example, represented by the .el7 suffix in the version). Choose a specific version to install. The second column is the version string. The third column is the name of the mirror warehouse, which indicates which mirror warehouse the software package comes from and is listed by its stability level.

To install a specific version, append the version string to the package name and separate them with a hyphen (-):

 $ sudo yum install docker-ce-<VERSION>
Copy after login

4.4. Start Docker

 $ sudo systemctl start docker
Copy after login

4.5. Verify that docker is installed correctly by running the hello-world image.

$ sudo docker run hello-world
Copy after login

Recommended related tutorials: docker tutorial

The above is the detailed content of How to install docker ce. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!