How to start Docker container so that it uses Host Network?


I am starting a dockerized SpringBoot based webapp which needs Postgre to start, I have Postgre in my host machine. So how can start my container so that it uses the Postgre from host machine?

1 Answer

6 years ago by

You are looking for host networking mode. That way your docker container will have all access to host networking hence the Postgre which is running in host. Add --network host while starting your container.

docker run  -d --network host -it  your_app:your_app_tag
6 years ago by Eleven