一键启动 redis php mysql nginx
- 下面的compose 是在windows使用的
- 数据卷挂载使用的bing 目录
- 如果在nginx里面使用到了php,就要先启动php在启动nginx ,也就是说下面容器启动顺序不用变
- windows下
/d/docker = D:\docker
,使用D:\docker
是挂载不上的
# 一键启动 redis php mysql nginx
version: '3'
services:
php:
image: "php7.3.4:v1"
container_name: php
ports:
- "9999:9000"
volumes:
- /d/docker/node/nginx/project/service:/www
networks:
- dnmp
nginx:
image: "nginx:latest"
container_name: nginx
ports:
- "8888:80"
volumes:
- /d/docker/node/nginx/conf/nginx.conf:/etc/nginx/nginx.conf
- /d/docker/node/nginx/project/service:/etc/nginx/html/project/liyouedu-service
- /d/docker/node/nginx/logs:/var/log/nginx
- /d/docker/node/nginx/vhosts:/etc/nginx/vhosts
networks:
- dnmp
mysql:
image: "mysql:5.7"
container_name: mysql
ports:
- "3366:3306"
environment:
MYSQL_ROOT_PASSWORD: root
volumes:
- /d/docker/node/mysql/my.cnf:/etc/my.cnf
- /d/docker/node/mysql/data:/var/lib/mysql
networks:
- dnmp
redis:
image: "redis:latest"
container_name: redis
command: redis-server /etc/redis/redis.conf
ports:
- "6399:6379"
volumes:
- /d/docker/node/redis/conf/redis.conf:/etc/redis/redis.conf
- /d/docker/node/redis/data:/data
networks:
- dnmp
networks:
dnmp:
external: true //代表网络已经创建直接使用