官网方式
Install on Linux🔗
You can install Compose V2 by downloading the appropriate binary for your system from the project release page and copying it into
$HOME/.docker/cli-plugins
as docker-compose
.- Run the following command to download the current stable release of Docker Compose:
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
This command installs Compose V2 for the active user under
$HOME
directory. To install Docker Compose for all users on your system, replace ~/.docker/cli-plugins
with /usr/local/lib/docker/cli-plugins
.- Apply executable permissions to the binary:
chmod +x $DOCKER_CONFIG/cli-plugins/docker-compose
- Test your installation
docker compose version