Can't connect to container on localhost with port mapping

Note that you can’t connect to that IP address from another host and it’s not constant if a container stops and restarts. There are better ways to reach a container (using docker run -p to publish a port on the host; using Docker’s internal DNS service to communicate between containers).

In short: I’d suggest never running docker inspect to find a container’s private IP address: it’s just not useful.

1 Like