docker-compose安裝nginx、php-fpm、mysql
阿新 • • 發佈:2019-04-05
version: '3'
services:
nginx:
container_name: nginx
image: nginx
restart: always
networks:
net-web:
ipv4_address: 172.19.0.2
volumes:
- /mnt:/usr/share/nginx/html
- ./nginx/conf:/etc/nginx/conf.d
- ./nginx/log:/var/log/nginx
- ./nginx/nginx.conf:/etc/nginx/nginx.conf
ports:
- 80:80
- 443:443
environment:
- TZ=Asia/Shanghai
fpm5.6:
container_name: fpm5.6
build: ./php/php5.6
restart: always
ports:
- 9000:9000
volumes:
- ./php/php5.6/php.ini:/usr/local/etc/php/php.ini-production:rw
- ./php/php5.6/php-fpm.conf:/usr/local/etc/php-fpm.conf:rw
- ./php/php5.6/conf.d:/usr/local/etc/conf.d:rw
- ./php/php5.6/www.conf:/usr/local/etc/php-fpm.d/www.conf:rw
- ./php/php5.6/zz-docker.conf:/usr/local/etc/php-fpm.d/zz-docker.conf
- ./php/php5.6/log/:/var/log/php/:rw
- /mnt:/usr/share/nginx/html:rw
networks:
net-web:
ipv4_address: 172.19.0.5
fpm7.2:
container_name: fpm7.2
build: ./php/php7.2
restart: always
ports:
- 9072:9000
volumes:
- ./php/php7.2/php.ini:/usr/local/etc/php/php.ini:rw
- ./php/php7.2/php-fpm.conf:/etc/php/php-fpm.conf:rw
- ./php/php5.6/www.conf:/usr/local/etc/php-fpm.d/www.conf:rw
- ./php/php7.2/log/:/var/log/php/:rw
- /mnt:/usr/share/nginx/html:rw
networks:
net-web:
ipv4_address: 172.19.0.7
mysql:
image: mysql:5.7.24
container_name: "mysql"
volumes:
- /data/mysql/data:/var/lib/mysql
- /data/mysql/conf:/etc/mysql/conf.d
- /data/mysql/logs:/data/mysql/logs
restart: always
ports:
- "3306:3306"
environment:
- TZ=Asia/Shanghai # 設定時區
- MYSQL_ROOT_PASSWORD=qweasd # 設定 root 使用者密碼
command: --character-set-server=utf8mb4 --collation-server=utf8mb4_unicode_ci # 設定編碼
networks:
net-web:
ipv4_address: 172.19.0.3
networks:
net-web:
driver: bridge
ipam:
config:
- subnet: 17