美文网首页
get docker ce for centos

get docker ce for centos

作者: wangzaiplus | 来源:发表于2017-08-30 17:56 被阅读0次

文章参考自:docker官方文档

还可以参考菜鸟教程,中文,比较简单,菜鸟教程

由于我使用的是腾讯云centos服务器,参考菜鸟教程的安装过程中出现了could not resolve host mirrors.tencentyun.com no address associated with hostname trying other mirror错误,所以先解决掉此报错后就直接看官方文档了

1. 如果之前有安装过docker但失败了,可以先remove之前版本:

Uninstall old versions:

$ sudo yum remove docker \
                  docker-common \
                  docker-selinux \
                  docker-engine

2. Install Docker CE 安装docker:

  • Install using the repository
    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
  • 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
  • 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

3. INSTALL DOCKER CE

  • Update the yum package index
$ sudo yum makecache fast
  • Install the latest version of Docker CE, or go to the next step to install a specific version.
$ sudo yum install docker-ce
  • On production systems, you should install a specific version of Docker CE instead of always using the latest. List the available versions. This example uses the sort -r command to sort the results by version number, highest to lowest, and is truncated.
$ yum list docker-ce.x86_64  --showduplicates | sort -r

docker-ce.x86_64  17.06.0.el7                               docker-ce-stable  

4. Start Docker.

$ sudo systemctl start docker
  • Verify that docker is installed correctly by running the hello-world image.
$ sudo docker run hello-world

相关文章

网友评论

      本文标题:get docker ce for centos

      本文链接:https://www.haomeiwen.com/subject/cclxjxtx.html