安装docker
yum update
yum install -y yum-utils device-mapper-persistent-data lvm2
yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
sudo yum install docker-ce docker-ce-cli containerd.io
添加国内镜像
/etc/docker/daemon.json
参考:https://docs.docker.com/install/linux/docker-ce/centos/
安装docker-compose
安装最新版本的docker-compose需要先安装Python3,否则会出下面的报错信息:
ERROR: Package 'more-itertools' requires a different Python: 2.7.5 not in '>=3.5'
pip install --upgrade pip
pip install docker-compose
直接执行docker-compose
提示找不到命令,需要查找文件的安装位置
# find / -name 'docker-compose'
/usr/local/python3/bin/docker-compose
建立链接
ln -s /usr/local/python3/bin/docker-compose /usr/bin/docker-compose
参考:https://docs.docker.com/compose/install/
启用docker服务
systemctl start docker
网友评论