DEV Community

loading...

【Tips】Connect Host OS proccess by localhost from within Docker container

kohbis
Originally published at fushagoya.com ・1 min read

Tips for connecting Host OS process by localhost from within Docker container.

This is used when the container is running without using docker-compose for each process.

$ docker run -it --rm --add-host=localhost:$(ipconfig getifaddr en0) IMAGE
Enter fullscreen mode Exit fullscreen mode

Incidentally, if you don't use localhost and you are using Docker Desktop for Mac, you can connect using the DNS name host.docker.internal.

Discussion (0)

Forem Open with the Forem app