docker官方文档
(https://docs.docker.com/install/linux/docker-ce/centos/)

安装前删除旧版本

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

安装配置包

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

设置yum下载源(国内)

$ sudo yum-config-manager 
    --add-repo 
    https://mirrors.ustc.edu.cn/docker-ce/linux/centos/docker-ce.repo

查看docker配置

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

最新版本的docker

$ sudo yum install docker-ce docker-ce-cli containerd.io

测试版的docker

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

更新源并安装docker-ce

$ sudo yum makecache fast
$ sudo yum install docker-ce

启动docker-ce

$ sudo systemctl enable docker
$ sudo systemctl start docker

配置镜像加速器并重启docker

sudo mkdir -p /etc/docker
sudo tee /etc/docker/daemon.json 

docker-compose 安装
(https://docs.docker.com/compose/install/)
下载docker-compose

curl -L https://github.com/docker/compose/releases/download/1.25.0-rc2/docker-compose-`uname -s`-`uname -m` -o /usr/local/bin/docker-compose

分配权限

sudo chmod +x /usr/local/bin/docker-compose

文章来源于互联网,如有雷同请联系站长删除:CentOS 7 安装docker 与 docker-compose

发表评论