I trieddocker run --net=host -d --name pdns-recursor pschiffe/pdns-recursor and it works. Now my goal is to use dockerfile to pass some environment without errors.
I tried:
networks: name: hostand
networks: name: "host"and also the examples indicated here.
I always get an The Compose file './docker-compose.yml' is invalid because: services.recursor.networks.name contains an invalid type, it should be an object, or a null.
Any suggestions are much appreciated.
31 Answer
Use network_mode instead:
network_modeNetwork mode. Use the same values as the docker client
--networkparameter, plus the special formservice:[service name].network_mode: "bridge" network_mode: "host" network_mode: "none"
You can use networks to specify host networking in swarm mode, by setting the driver of a given network to host.