跳转至

docker-compose工具使用

概要: Compose is a tool for defining and running multi-container Docker applications. With Compose, you use a YAML file to configure your application’s services. Then, with a single command, you create and start all the services from your configuration.

创建时间: 2022.06.08 20:14:07

更新时间: 2023.08.03 01:01:27

获取docker-compose

此处以Linux的x86平台为例,首先在Releases · docker/compose上获取最新版的docker-compose,此处以v2.6.0为例

Bash
wget https://github.com/docker/compose/releases/download/v2.6.0/docker-compose-linux-x86_64

创建符号链接

假定刚刚下载的目录为/opt/docker-compose/

Bash
ln -s /opt/docker-compose/docker-compose-linux-x86_64 /usr/bin/docker-compose

赋予可执行权限

Bash
chmod +x /opt/docker-compose/docker-compose-linux-x86_64

测试是否安装成功

Bash
docker-compose version
输出
Bash
Docker Compose version v2.6.0

参考