What is the docker compose equivalent of running a docker container with network of container === host network ?
docker run --rm -d --network host --name my_nginx nginx
Basically, how to specify the --network host
inside docker-compose
What is the docker compose equivalent of running a docker container with network of container === host network ?
docker run --rm -d --network host --name my_nginx nginx
Basically, how to specify the --network host
inside docker-compose
2
Answers
Currently, I am running this by just specifying the port mappings from host to docker container, where I use the same port on both
eg :
You need to specify the network mode inside your service at docker-compose.yml. Add it like this: