centos7安装docker

官网文档:https://docs.docker.com/install/linux/docker-ce/centos/

1、Uninstall old versions

$ sudo yum remove docker
                  docker-client
                  docker-client-latest
                  docker-common
                  docker-latest
                  docker-latest-logrotate
                  docker-logrotate
                  docker-engine

2、Install using the repository

Install required packages.

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

Use the following command to set up the stable repository

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

Install Docker CE

$ sudo yum install docker-ce

Start Docker.

$ sudo systemctl start docker

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

$ sudo docker run hello-world

配置加速

Linux

curl -sSL https://get.daocloud.io/daotools/set_mirror.sh | sh -s http://f1361db2.m.daocloud.io

该脚本可以将 --registry-mirror 加入到你的 Docker 配置文件 /etc/docker/daemon.json 中。适用于 Ubuntu14.04、Debian、CentOS6 、CentOS7、Fedora、Arch Linux、openSUSE Leap 42.1,其他版本可能有细微不同。更多详情请访问文档。

原文地址:https://www.cnblogs.com/hougang/p/10305046.html