我有这个docker-compose文件:
version: "3.8"
services:
web:
image: apachephp:v1
ports:
- "80-85:80"
volumes:
- volume:/var/www/html
network_mode: bridge
ddbb:
image: mariadb:v1
ports:
- "3306:3306"
volumes:
- volume2:/var/lib/mysql
network_mode: bridge
environment:
- MYSQL_ROOT_PASSWORD=*********
- MYSQL_DATABASE=*********
- MYSQL_USER=*********
- MYSQL_PASSWORD=*********
volumes:
volume:
name: volume-data
volume2:
name: volume2-data
当运行以下代码时:
docker-compose up -d --scale web=2
它也可以正常工作,但会收到这个警告:
WARNING: The "web" service specifies a port on the host. If multiple containers for this service are created on a single host, the port will clash.
有人能帮助避免这些警告吗?谢谢您的帮助。
最好的问候。