The equivalent configuration for docker-compose v3 is using the network_mode key: https://docs.docker.com/compose/compose-file/compose-file-v3/#network_mode
You should set network_mode to "host" in your docker-compose.yml.
If using docker swarm, see codestation’s answer.