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

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

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.

← Posts