version: "3"
services:
fpm:
image: php:7.2.0-fpm-alpine3.6
container_name: fpm
volumes:
- /home/shenyi/php:/php
networks:
mywebnet:
ipv4_address: 192.158.0.2
httpd:
image: httpd:2.4-alpine
container_name: httpd
ports:
- 80:80
volumes:
- /home/shenyi/php:/usr/local/apache2/htdocs/
- /home/shenyi/conf/httpd.conf:/usr/local/apache2/conf/httpd.conf
networks:
mywebnet:
ipv4_address: 192.158.0.3
/**设置网络**/
networks:
mywebnet:/*网络名称 随意*/
driver: bridge
ipam:
config:
- subnet: 192.158.0.0/16
以上是 docker-compose.yml
docker-compose up -d
docker-compose stop
docker-compose -p php up -d --别名启动
docker-compose -p php stop --别名停止
docker-composer network pune