运行以下命令,下载Docker Compose的当前稳定版本
$ mkdir -p ~/.docker/cli-plugins/ $ curl -SL https://github.com/docker/compose/releases/download/v2.0.1/docker-compose-linux-x86_64 -o ~/.docker/cli-plugins/docker-compose
该命令为$HOME目录下的活动用户安装Compose V2。为系统中的所有用户安装Docker Compose
$ mkdir -p /usr/local/lib/docker/cli-plugins $ curl -SL https://github.com/docker/compose/releases/download/v2.2.2/docker-compose-linux-x86_64 -o /usr/local/lib/docker/cli-plugins/docker-compose
$ chmod +x ~/.docker/cli-plugins/docker-compose
$ docker compose version Docker Compose version v2.2.2
docker compose 代替了 docker-compose 命令 。 docker-compose命令是 v1版的命令
第一步下载 可以从下面页下载稳定版 docker-compose-linux-x86_64
https://github.com/docker/compose/releases
上传到 /usr/local/lib/docker/cli-plugins/ 目录下 并且修改 docker-compose-linux-x86_64 文件名为 docker-compose