I'm building the docker-compose service that includes two containers. One of those containers (node) is designed to support an auto-discovery mechanism and needs to be a part of the host LAN (as I need multicast UDP packages to be handled by the LAN router, not the built-in docker router).
While the "network_mode: host" in docker-compose.yml perfectly does the trick, I need this service to be also available to a second container (qtcore) by its hostname via the default docker-compose network (like that: http://node:37326). And that doesn't seem to be possible with the network_mode set to "host".
My docker-compose.yml currently looks like this:
version: '3.7'
services:
qtcore:
image: yansidorovtesseris/qtcore
build: .
container_name: qtcore
depends_on:
- node
env_file: defaults.env
ports:
- "8000:8000"
node:
image: yansidorovtesseris/komodo
container_name: node
env_file: node.env
ports:
- "37326:37326"
- "1900:1900"
network_mode: host
volumes:
- $HOME/node_state:/komodo/.komodo/$AC_NAME
I've tried to use the sample from the docker-compose docs (https://docs.docker.com/compose/compose-file/#host-or-none) to connect the host network as an external network. With the thought to add both host and default networks to a service.
version: '3.7'
services:
node:
...
networks:
hostnet: {}
...
networks:
hostnet:
external: true
name: host
But all I get when I try to run the docker-compose is the following error:
ERROR: for node network-scoped alias is supported only for containers in user defined networks