Linux主机中起了一个 rabbitmq
容器,又起了一个 xxx
服务容器,这个 xxx
怎么连接到 rabbitmq
容器?
因为都是在一台 Linux 中,我在 xxx
服务容器中填写 localhost
+ 端口貌似不行,把 localhost
改成 内网 ip
就行,比如 (192.168.31.100),但是写死为内网 IP
不行呀,因为内网 IP
会变化
已经设为 network_mode: "host"
docker-compose.yml
version: "3"
services:
elasticsearch_service:
container_name: elasticsearch_service
image: xxx/xxx_service
network_mode: "host"
env_file:
- .env
command: nameko run services:ElasticsearchService --config ./config.yaml