Install Docker CE use repository

内容摘抄dockers官网

https://docs.docker.com/engine/installation/linux/docker-ce/centos/#install-from-a-package

一。Install using the repository
设置repository
1.Install required packages. yum-utils provides the yum-config-manager utility, and device-mapper-persistent-data and lvm2 are required by the devicemapper storage driver.

$ sudo yum install -y yum-utils \
  device-mapper-persistent-data \
  lvm2

2.Use the following command to set up the stable repository. You always need the stable repository, even if you want to install builds from the edge or test repositories as well.

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

3.Optional: Enable the edge and test repositories. These repositories are included in the docker.repo file above but are disabled by default. You can enable them alongside the stable repository.

$ sudo yum-config-manager --enable docker-ce-edge

$ sudo yum-config-manager --enable docker-ce-test

You can disable the edge or test repository by running the yum-config-manager command with the --disable flag. To re-enable it, use the --enable flag. The following command disables the edge repository.

$ sudo yum-config-manager --disable docker-ce-edge

二。安装
Install Docker CE
查看安装的版本

$ yum list docker-ce --showduplicates | sort -r

Note: The version string is the package name plus the version up to the first hyphen. In the example above, the fully qualified package name is docker-ce-17.06.1.ce.

$ sudo yum install 
$ sudo yum install -y docker-ce-17.06.1.ce

三。运行

$ sudo systemctl start docker
$ sudo systemctl enable docker
$ sudo docker run hello-world

你可能感兴趣的:(Install Docker CE use repository)