怎么安装docker-compose
使用下列命令下载docker-compose(可选择其他版本)
wget https://github.com/docker/compose/releases/download/v2.16.0/docker-compose-linux-x86_64 --no-check-certificate
然后把该文件移动到/usr/local/bin/并重命名
mv docker-compose-linux-x86_64 /usr/local/bin/docker-compose
如果原来/usr/local/bin/目录下有docker-compose文件,会提示是否需要覆盖,输入y覆盖即可。
现在使用docker-compose可以测试一下是否安装成功
docker-compose
Usage: docker compose [OPTIONS] COMMANDDocker ComposeOptions:--ansi string Control when to print ANSI control characters ("never"|"always"|"auto") (default "auto")--compatibility Run compose in backward compatibility mode--env-file string Specify an alternate environment file.-f, --file stringArray Compose configuration files--parallel int Control max parallelism, -1 for unlimited (default -1)--profile stringArray Specify a profile to enable--project-directory string Specify an alternate working directory(default: the path of the, first specified, Compose file)-p, --project-name string Project nameCommands:build Build or rebuild servicesconfig Parse, resolve and render compose file in canonical formatcp Copy files/folders between a service container and the local filesystemcreate Creates containers for a service.down Stop and remove containers, networksevents Receive real time events from containers.exec Execute a command in a running container.images List images used by the created containerskill Force stop service containers.logs View output from containersls List running compose projectspause Pause servicesport Print the public port for a port binding.ps List containerspull Pull service imagespush Push service imagesrestart Restart service containersrm Removes stopped service containersrun Run a one-off command on a service.start Start servicesstop Stop servicestop Display the running processesunpause Unpause servicesup Create and start containersversion Show the Docker Compose version informationRun 'docker compose COMMAND --help' for more information on a command.
显示如上信息则代表安装成功。