1、安装Docker
更换源仓库为国内阿里源以提升安装速度,安装docker
yum-config-manager --add-repo http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
yum -y install docker-ce
2、加入开机启动
systemctl start docker
systemctl enable docker
3、 查看是否安装成功
docker version
4、安装Docker-compose
-
安装python pip
1、首先检查linux有没有安装python-pip包,终端执行 pip -V
pip -V
2、没有python-pip包就执行命令
yum -y install epel-release
3、执行成功之后,再次执行yum -y install python-pip
yum -y install python-pip
4、对安装好的pip进行升级 pip install --upgrade pip
pip install --upgrade pip
(至此,pip安装好了,执行pip -V 再次检查pip环境。)
-
安装Docker-Compose
- 终端执行:pip install docker-compose
pip install docker-compose
若报错Cannot uninstall 'requests'. It is a distutils installed project and thus we cannot accurately determine which files belong to it which would lead to only a partial uninstall
执行:
pip install docker-compose --ignore-installed requests
- 检查docker-compose 安装
docker-compose -version
5、更换docker源
- 修改配置文件,仓库地址
vim /etc/docker/daemon.json
{
"registry-mirrors":["https://registry.docker-cn.com"]
}
- 重启docker服务
systemctl restart docker.service
- 至此docker和docker-compose安装完成