前言
- Docker version 1.13.1, build 7d71120/1.13.1
- CentOS Linux release 7.9.2009 (Core)
Docker Compose介绍
Docker Compose是一个用来定义和运行复杂应用的Docker工具。
安装方式1:Linux
官方安装说明在这里。
- 下载Docker Compose:
shell> sudo curl -L --fail \
"https://github.com/docker/compose/releases/download/1.29.2/docker-compose-$(uname -s)-$(uname -m)" \
-o /usr/local/bin/docker-compose
- 给docker-compose文件添加执行权限:
shell> sudo chmod +x /usr/local/bin/docker-compose
- 将docker-compose(软链接)添加到
/usr/bin
目录:
shell> sudo ln -s /usr/local/bin/docker-compose /usr/bin/docker-compose
注:不一定非要添加到/usr/bin
,也可以添加到其它的、属于PATH的目录。
- 检查是否安装成功
shell> docker-compose --version
docker-compose version 1.29.2, build 5becea4
安装方式2:PIP
官方安装说明在这里。
- 安装PIP:
shell> yum install -y python3-pip
- 给docker-compose文件添加执行权限:
shell> pip3 install docker-compose
WARNING: Running pip install with root privileges is generally not a good idea. Try `pip3 install --user` instead.
Collecting docker-compose
Downloading http://mirrors.tencentyun.com/pypi/packages/f3/3e/ca05e486d44e38eb495ca60b8ca526b192071717387346ed1031ecf78966/docker_compose-1.29.2-py2.py3-none-any.whl (114kB)
...
100% |████████████████████████████████| 573kB 2.8MB/s
Complete output from command python setup.py egg_info:
=============================DEBUG ASSISTANCE==========================
If you are seeing an error here please try the following to
successfully install cryptography:
Upgrade to the latest pip and try again. This will fix errors for most
users. See: https://pip.pypa.io/en/stable/installing/#upgrading-pip
=============================DEBUG ASSISTANCE==========================
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/tmp/pip-build-7s6fe6so/cryptography/setup.py", line 14, in <module>
from setuptools_rust import RustExtension
ModuleNotFoundError: No module named 'setuptools_rust'
----------------------------------------
- 检查是否安装成功
shell> docker-compose --version
docker-compose version 1.29.2, build 5becea4
安装方式3:容器方式
官方安装说明在这里。
- 下载脚本:
shell> sudo curl -L --fail \
https://github.com/docker/compose/releases/download/1.29.2/run.sh \
-o /usr/local/bin/docker-compose
- 添加执行权限:
shell> sudo chmod +x /usr/local/bin/docker-compose
- 检查是否安装成功
shell> docker-compose --version
Unable to find image 'docker/compose:1.29.2' locally
Trying to pull repository docker.io/docker/compose ...
1.29.2: Pulling from docker.io/docker/compose
339de151aab4: Pull complete
484a7070e879: Pull complete
6391cb0e5266: Pull complete
aaaf585806ed: Pull complete
Digest: sha256:ae66070588c539b965986dc74e9371e3e62ef71668b72a5eed70de111ed3659e
Status: Downloaded newer image for docker.io/docker/compose:1.29.2
docker-compose version 1.29.2, build 5becea4
镜像
daocloud:https://get.daocloud.io/