centos7.6安装docker和docker-compose
一、docker 安装
1、升级所有包(这步版本够用不要随便进行,会更新系统内核,可能导致开不了机)
yum update
2、安装依赖包
yum install -y yum-utils device-mapper-persistent-data lvm2
3、添加aliyun docker软件包源
yum-config-manager --add-repo http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
4、添加软件包源到本地缓存
yum makecache fast
rpm --import https://mirrors.aliyun.com/docker-ce/linux/centos/gpg
5、安装docker
yum -y install docker-ce
6、设置开机启动docker
systemctl enable docker
7、重启docker
systemctl restart docker
二、docker-compose安装
1、检查linux有没有安装python-pip包
yum install python-pip -y
2、没有python-pip包就执行命令
yum -y install epel-release
3、执行成功之后,再次执行
yum install python-pip
4、对安装好的pip进行升级
pip install --upgrade pip
5、安装docker-compose,安装过程中会遇到一些坑,参考下面异常和解决办法进行处理,然后再尝试执行命令:
pip install docker-compose
异常以及解决办法
异常1:jsonschema 3.2.0 has requirement six>=1.11.0, but you’ll have six1.9.0 which is incompatible
执行命令:
pip install six --user -U
pip install ipython --user -U
异常2:building wheel for subprocess32 (setup.py) 和 running setup.py install for subprocess32 … error
执行命令:
yum install python-devel
yum groupinstall "Development Tools"
yum install -y gcc g++ kernel-devel
异常3: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 --ignore-installed requests
6、安装成功后,执行命令,查看docker-compose是否安装成功
docker-compose -version