如果要编排的容器较多,建议使用目录将docker-compose.yml分隔开来
[root@localhost ~]# mkdir test
[root@localhost ~]# cd test/
[root@localhost test]# vim docker-compose.yml
nginx:
container_name: nginx91
image: nginx:latest
ports:
- "8091:80"
volumes:
- /www/wwwroot/8091:/usr/share/nginx/html
hostname: nginx.test.com
#
nginx-php:
container_name: nginx92
image: nginx:latest
ports:
- "8092:80"
volumes:
- /www/wwwroot/8092/:/usr/share/nginx/html
hostname: nginx-php.test.com