Accessing host machine from within docker container

Try connecting the container to the ‘host’ network.
e.g. –

docker run --network host ...

Run this from within the container to get the IP of the host:

route | awk '/^default/ { print $2 }'
3 Likes