Centos安装Docker、DockerCompose

头像
码农笔录
2021-09-30 运维 阅读量 2546

1.更新系统

yum update -y

2.安装docker

yum install -y yum-utils

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

yum install docker-ce docker-ce-cli containerd.io -y

systemctl start docker

3.安装docker-compose

版本查看地址 https://github.com/docker/compose/releases

wget -c -t 0 https://github.com/docker/compose/releases/download/1.29.2/docker-compose-`uname -s`-`uname -m` -O /usr/local/bin/docker-compose

chmod a+rx /usr/local/bin/docker-compose

docker-compose -v

4.阿里云docker加速

https://*****.mirror.aliyuncs.com 需要配置成你的加速地址,阿里云-> 控制台 ->容器镜像服务

mkdir -p /etc/docker

tee /etc/docker/daemon.json <<-'EOF'
{
  "registry-mirrors": ["https://*****.mirror.aliyuncs.com"]
}
EOF

systemctl daemon-reload

systemctl restart docker