version: '3'
services:
nginx:
image: nginx:latest
networks:
- mylnmp
ports:
- "8080:80"
links:
- "mysql"
volumes:
- /root/nginx/html/:/var/www/html/
phpfpm:
tty: true
networks:
- mylnmp
image: php
ports:
- "9000:9000"
volumes:
- /root/nginx/html/:/var/www/html/
links:
- "mysql"
mysql:
image: mysql:latest
networks:
- mylnmp
ports:
- "3307:3306"
volumes:
- /root/mysql/data/:/var/lib/mysql/
environment:
MYSQL_ROOT_PASSWORD : 123456
networks:
mylnmp:
错误:ERROR 2002 (HY000): Can’t connect to local MySQL server through socket ‘/var/lib/mysql/mysql.sock’
原因:端口冲突3306