phowat
(Phowat)
May 14, 2019, 11:22pm
1
Hi, according to this , starting on Docker 17.06 I can use a host network for a swarm service. I tried adding network_mode to a service in my config file but it gets ignored.
Ignoring unsupported options: network_mode
Isn’t that the correct option?
My service is defined along these lines:
version: ‘3.4’
services:
coturn:
image: boldt/coturn
hostname: xxx
network_mode: host
…
deploy:
replicas: 1
restart_policy:
condition: on-failure
delay: 5s
max_attempts: 3
window: 120s
Hey @phowat
this is a known issue
so host network_mode cannot be used in docker swarm.
please read below link
phowat
(Phowat)
May 15, 2019, 3:48am
3
Hi @nishitmv , thanks for the reply. My original question was not phrased in the best way, let me try to clarify.
I managed to get it working by creating the service manually, outside my compose file, with the following command:
docker service create --env-file ./coturn.env
–mount type=bind,source=xxx.pem,destination=/etc/ssl/turn_server_cert.pem
–mount type=bind,source=xxx.pem,destination=/etc/ssl/turn_server_pkey.pem
–replicas 1 --name coturn --network host boldt/coturn
So, is there an option to be used in the compose file that does the same as the --network option from the command line ?
So you can use networks option like this
version: '3.4'
services:
apple:
image: "nginx:alpine"
networks:
- outside
networks:
outside:
external:
name: "host"
it will attach the container to host network
please read below for more info about it
2 Likes
@nitishmowall
when using this host network, service name is not resolving inside the container. And also network alisa is not working. Any idea why so?
I am using docker stack deploy