sudo curl -L "https://github.com/docker/compose/releases/download/1.24.0/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
sudo chmod +x /usr/local/bin/docker-compose
工具:yaml检查的在线工具http://www.yamllint.com/
services:
web1:
container_name: web1
image: "centos:jdk"
healthcheck:
test: ["CMD", "curl","-s","-f", "http://localhost:80"]
interval: 5s
timeout: 5s
retries: 3
ports:
- "8080:80"
privileged: true
volumes:
- "/home/shenyi/nginx/web1/:/var/www/html/"
networks:
mynginx-net:
ipv4_address: ${web1_addr}
web2:
container_name: web2
image: "centos:jdk"
ports:
- "8081:80"
privileged: true
volumes:
- "/home/shenyi/nginx/web2/:/var/www/html/"
networks:
mynginx-net:
ipv4_address: 192.156.0.3
healthcheck:
test: ["CMD", "curl","-s","-f", "http://localhost:80"]
interval: 5s
timeout: 5s
retries: 3
nginx:
container_name: mynginx
image: "centos:nginx"
healthcheck:
test: ["CMD", "curl","-s","-f", "http://localhost:80"]
interval: 5s
timeout: 5s
retries: 3
ports:
- "9090:80"
privileged: true
volumes:
- "/home/shenyi/nginx/conf/nginx.conf:/etc/nginx/nginx.conf"
networks:
mynginx-net:
ipv4_address: 192.156.0.2
networks:
mynginx-net:
driver: bridge
ipam:
config:
- subnet: 192.156.0.0/16
version: "3"