Centos7 安装 Docker和Docker-composer

那存
2023-12-01

1、更新yum以及支持devicemapper存储类型

# yum update
# yum install -y yum-utils device-mapper-persistent-data lvm2

2、添加Docker稳定版的yum软件源

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

3、之后更新yum软件缓存,并安装Docker

# yum update
# yum install -y docker-ce

4、确认Docker服务启动正常

# systemctl start docker

5、安装docker-composer

# sudo curl -L "https://github.com/docker/compose/releases/download/1.24.1/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose # 因为我下载很慢,所以直接在github上面下载然后把文件上传到服务器,github: https://github.com/docker/compose/releases/tag/1.24.1
# sudo chmod +x /usr/local/bin/docker-compose
# sudo ln -s /usr/local/bin/docker-compose /usr/bin/docker-compose
# docker-compose --version

6、更换docker国内源

vim /etc/docker/daemon.json #修改修改daemon配置文件输入

{
  "registry-mirrors": ["https://desaby25.mirror.aliyuncs.com"]
}

# systemctl daemon-reload
# systemctl restart docker

 

 类似资料: