docker-compose中scale多个web时hostname只有一个
来源:6-4 水平扩展和负载均衡
慕函数6990799
2018-04-02
version: '3'
services:
web:
image: "nginx"
#ports:
# - "80:80"
volumes:
- /etc/nginx:/etc/nginx
- /opt/web/:/usr/share/nginx/html/
command: nginx -g 'daemon off;'
php:
build: ./php
volumes:
- /opt/web/:/usr/share/nginx/html/
mysql:
image: mysql
ports:
- "3306:3306"
environment:
MYSQL_ROOT_PASSWORD: 123456
redis:
image: redis:4.0
ports:
- "6379:6379"
lb:
image: dockercloud/haproxy
links:
- web
volumes:
- /var/run/docker.sock:/var/run/docker.sock
ports:
- "8080:80"
这个是我的yml配置
下面是只访问一个hostname
1回答
-
麦兜搞IT
2018-04-02
您好,这样,您先试试在命令行里,通过curl 127.0.0.1:8080,试试他有没有做负载均衡
00
相似问题