Docker Community Forums

Share and learn in the Docker community.

How do docker use the hostname get its IP

I am a green hand of docker. Currently, I am so confused about the way of how to get the IP through docker’s hostname.

Does the mapping info store in a file?
Or other ways?

As a newbie you should’t care about IP addresses. You publish a port from a container to the Docker host and then access it at localhost:someport. Read ‘How to use this image’ for the httpd image.

Or, if you want to access from one container to another, you connect by the <hostname | service name>: and let docker resolve any internal ip.