Docker】之 Docker Compose v2 安装

Docker Compose v2 安装

官网安装地址

https://docs.docker.com/compose/cli-command/

设置环境变量

DOCKER_CONFIG=${DOCKER_CONFIG:-$HOME/.docker}

创建存放目录

mkdir -p $DOCKER_CONFIG/cli-plugins

下载文件

curl -SL https://github.com/docker/compose/releases/download/v2.2.3/docker-compose-linux-x86_64 -o $DOCKER_CONFIG/cli-plugins/docker-compose

# 可替换为国内地址
curl -SL https://get.daocloud.io/docker/compose/releases/download/v2.2.3/docker-compose-`uname -s`-`uname -m` -o $DOCKER_CONFIG/cli-plugins/docker-compose

修改执行权限

chmod +x $DOCKER_CONFIG/cli-plugins/docker-compose

测试是否成功

docker compose version