官网地址: https://docs.docker.com/compose/completion/#install-command-completion
文档: https://docs.docker.com/compose/compose-file/
https://docs.docker.com/compose/install/
1. Run this command to download the latest version of Docker Compos
sudo curl -L "https://github.com/docker/compose/releases/download/1.22.0/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
sudo curl -L "https://github.com/docker/compose/releases/download/1.29.2/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
2. Apply executable permissions to the binary:
sudo chmod +x /usr/local/bin/docker-compose
3. Test the installation
docker-compose --version
4. Uninstallation
To uninstall Docker Compose if you installed using curl
:
sudo rm /usr/local/bin/docker-compose
docker-compose.yaml
version: '3'
services:
eurake:
image: "192.168.1.168:5000/eurake:1.0.2"
ports:
- "11000:11000"
同个服务,多个实例,这里服务名称要区分下,比如eurake0,eurake1
version: '3'
services:
#eurake:
# build: /jar
# ports:
# - "11000:11000"
eurake0:
image: "192.168.1.168:5000/eurake:1.0.2"
ports:
- "11000:11000"
eurake1:
image: "192.168.1.168:5000/eurake:1.0.2"
ports:
- "11001:11000"
# mysql
# privileged: true 有权限 不指定 mysql没启动
version: '3'
services:
mysql:
privileged: true
image: "myrepo.com:5000/mysql:5.17"
ports:
- "13306:3306"
5. 启动
docker-compose up
6.关闭 If you started Compose with docker-compose up -d
, stop your services once you’ve finished with them:
docker-compose stop
看启动
docker-compose ps
看日志
docker-compose logs
#指定配置文件
docker-compose -f mysql.yaml up
# 后台运行
docker-compose -f mysql.yaml up -d