编辑 docker - compose . yml 文件 定义四个服务( php nginx mysql redis ) 四个服务使用同一个网络 Inmp - net php 依赖于 mysql Nginx 依赖于 php 和 mysql Nginx 需要定义端口号80:80数据挂载/ Inmp :/ usr / share / nginx / html Php 需要定义端口号9000:9090数据挂载/ Inmp :/ www Mysql 需要定义端口3306:3306环境变量 MYSQL _ ROOT _ PASSWORD =123456
时间: 2024-02-26 16:56:47
浏览: 157
好的,以下是 docker-compose.yml 文件的内容:
version: '3'
services:
image: php
ports:
- "9000:9090"
volumes:
- ./php:/www
networks:
- inmp-net
depends_on:
- mysql
nginx:
image: nginx
ports:
- "80:80"
volumes:
- ./nginx:/usr/share/nginx/html
networks:
- inmp-net
depends_on:
- php
- mysql
mysql:
image: mysql
ports:
- "3306:3306"
environment:
MYSQL_ROOT_PASSWORD: "123456"
networks:
- inmp-net
redis:
image: redis
networks:
- inmp-net
networks:
inmp-net:
这个文件定义了四个服务:php、nginx、mysql、redis,它们都使用了同一个网络 inmp-net。php 依赖于 mysql,nginx 依赖于 php 和 m
相关推荐















