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 <FULLY-QUALIFIED-PACKAGE-NAME>
$ sudo yum install -y docker-ce-17.06.1.ce

三。運行

$ sudo systemctl start docker
$ sudo systemctl enable docker
$ sudo docker run hello-world
最后編輯于
?著作權歸作者所有,轉載或內容合作請聯系作者
平臺聲明:文章內容(如有圖片或視頻亦包括在內)由作者上傳并發布,文章內容僅代表作者本人觀點,簡書系信息發布平臺,僅提供信息存儲服務。

推薦閱讀更多精彩內容