Centos下安装部署Docker-Compose
在安装docker后,可以使用docker run 启动镜像,但是使用docker-compose 更便于容器的编排管理,在Centos环境下,可以通过指令实现compose的安装配置。
1. 安装pip应用
使用以下指令安装python3及pip
sudo yum install -y python3 python3-pip
2. 升级pip
使用pip3 install --upgrade pip指令升级pip,不升级执行compose安装,可能会出现异常
[root@localhost docker]# pip3 install --upgrade pip
WARNING: Running pip install with root privileges is generally not a good idea. Try `pip3 install --user` instead.
Collecting pip
Downloading https://files.pythonhosted.org/packages/a4/6d/6463d49a933f547439d6b5b98b46af8742cc03ae83543e4d7688c2420f8b/pip-21.3.1-py3-none-any.whl (1.7MB)
100% |████████████████████████████████| 1.7MB 46kB/s
Installing collected packages: pip
Successfully installed pip-21.3.1
3. 执行docker-compose安装
使用pip3 install docker-compose 指令,可以执行docker-compose安装,安装成功后,可以通过docker-compose -v指令查看成功安装的版本
[root@localhost docker]# pip3 install docker-compose
WARNING: pip is being invoked by an old script wrapper. This will fail in a future version of pip.
Please see https://github.com/pypa/pip/issues/5599 for advice on fixing the underlying issue.
To avoid this problem you can invoke Python with '-m pip' instead of running pip directly.
Collecting docker-compose
Using cached docker_compose-1.29.2-py2.py3-none-any.whl (114 kB)
Collecting texttable<2,>=0.9.0
Using cached texttable-1.7.0-py2.py3-none-any.whl (10 kB)
[root@localhost docker]# docker-compose -v
/usr/local/lib/python3.6/site-packages/paramiko/transport.py:32: CryptographyDeprecationWarning: Python 3.6 is no longer supported by the Python core team. Therefore, support for it is deprecated in cryptography. The next release of cryptography will remove support for Python 3.6.
from cryptography.hazmat.backends import default_backend
docker-compose version 1.29.2, build unknown
至此,完成docker-compose部署安装。