1

 centos 未装docker

    sudo yum install -y yum-utils device-mapper-persistent-data lvm2
    # 注意,下面wget路径是我自己的服务器,每1分钟同步一次docker官网 docker-ce.repo 文件(不知道为啥阿里云可以wget下来,所以直接就写了个定时任务按时wget到网站目录,给timeout用户用一下)
    wget -O /etc/yum.repos.d/docker-ce.repo http://xiaozhugrape.com:8889/docker-ce.repo
    sudo sed -i 's+download.docker.com+mirrors.tuna.tsinghua.edu.cn/docker-ce+' /etc/yum.repos.d/docker-ce.repo
    sudo yum makecache fast
    sudo yum -y install docker-ce
    sudo curl -L https://github.com/docker/compose/releases/download/1.20.1/docker-compose-$(uname -s)-$(uname -m) -o /usr/local/bin/docker-compose
    sudo chmod +x /usr/local/bin/docker-compose
    sudo systemctl start docker

centos装过docker请执行

sudo yum remove docker \
                  docker-client \
                  docker-client-latest \
                  docker-common \
                  docker-latest \
                  docker-latest-logrotate \
                  docker-logrotate \
                  docker-selinux \
                  docker-engine-selinux \
                  docker-engine

然后执行 上面的命令

其他用户没啥说的,直接参考https://mirrors.tuna.tsinghua.edu.cn/help/docker-ce/

上面的有时候也不好使,用下面的

    curl -fsSL get.docker.com -o get-docker.sh
    sudo sh get-docker.sh
    sudo usermod -aG docker vagrant
    sudo curl -L https://github.com/docker/compose/releases/download/1.20.1/docker-compose-$(uname -s)-$(uname -m) -o /usr/local/bin/docker-compose
    sudo chmod +x /usr/local/bin/docker-compose

amorZhu
232 声望14 粉丝

安安静静写代码。