Open kiritoowo opened 5 years ago
这个怎么解决的,,我也遇到了!!!
使用了一个指令,让容器直接映射本机端口 --network=host
ok ,谢谢了
请问有没有其他解决方案啊? 这样一来每次都要改conf的
可以使用docker network create somenetwork 创建网络并进行统一设置,不过启动的时候也需要加入--net somenetwork指定自定义网络 ,可以参考官方文档进行自定义设置,官方文档地址:https://docs.docker.com/engine/reference/commandline/network_create/
可以试下使用overlay
网络模式或者双网卡的模式bridge+overlay
。在storage_ids.conf里面使用服务名。
docker-compose.yml
version: '3'
services:
webservice:
networks:
- frontend
apiservice:
networks:
# 因为apiservice除了要与fdfs的tracker和storage通信,还要与webservice通信,所以使用了双网卡
- frontend
- backend
fdfs-tracker0:
networks:
- backend
fdfs-tracker1:
networks:
- backend
fdfs-storage0:
networks:
- backend
fdfs-storage1:
networks:
- backend
networks:
# frontend网络用于其他服务的互相通信
frontend:
driver: bridge
# backend网络用于fdfs的tracker storage和client互相通信
backend:
driver: overlay
storage_ids.conf
10001 group1 fdfs-storage0
10002 group1 fdfs-storage1
storage.conf
tracker_server=fdfs-tracker0:22122
tracker_server=fdfs-tracker1:22122
storage的地址是docker虚拟网卡的地址 无法获取服务端连接资源:can't create connection to 172.17.0.1:23000