version: ‘3’
services:
nginx:
image: “nginx”
container_name: nginx
ports:
– 80:80
volumes:
– D:1kaifahuanjingdockerwnmpnginxhtml:/usr/share/nginx/html
– D:1kaifahuanjingdockerwnmpnginxconfnginx.conf:/etc/nginx/nginx.conf
– D:1kaifahuanjingdockerwnmpnginxlogs:/var/log/nginx
– D:1kaifahuanjingdockerwnmpnginxconfconf.d:/etc/nginx/conf.d
restart: always
networks:
lnmp:
ipv4_address: 192.168.0.2
php:
image: “php:7.3-fpm”
depends_on:
– nginx
container_name: php-fpm
volumes:
– D:1kaifahuanjingdockerwnmpnginxhtml:/var/www/html
– D:1kaifahuanjingdockerwnmpphpetc:/usr/local/etc
# command: php-fpm
restart: always
ports:
– 9000:9000
networks:
lnmp:
ipv4_address: 192.168.0.3
mysql:
image: “mysql:5.7”
container_name: mysql
# command: –default-authentication-plugin=mysql_native_password
#这行代码解决无法访问的问题
volumes:
- D:1kaifahuanjingdockerwnmpmysqlconf.d:/etc/mysql/conf.d
- D:1kaifahuanjingdockerwnmpmysqllogsmysql:/var/log/mysql
- D:1kaifahuanjingdockerwnmpmysqldata:/var/lib/mysql
environment:
- MYSQL_ROOT_PASSWORD=root
restart: always
ports:
- 3333:3306
networks:
lnmp:
ipv4_address: 192.168.0.4
# docker-php-ext-install mysqli pdo pdo_mysql
redis:
image: redis:latest
ports:
– “6379:6379”
container_name: redis
environment:
– TZ=Asia/Shanghai
restart: always
# volumes:
# – “./data:/data”
# – “./config/redis.conf:/etc/redis/redis.conf”
# command: redis-server /data/redis.conf
networks:
lnmp:
ipv4_address: 192.168.0.5
# composer:
# image: composer:latest
# command: [“composer”, “install” ] #update
# container_name: composer
# restart: always
# depends_on:
# – php
# volumes:
# – D:1kaifahuanjingComposer:/app
# networks:
# lnmp:
# ipv4_address: 192.168.0.6
networks:
lnmp:
driver: bridge
ipam:
driver: default
config:
– subnet: 192.168.0.0/16