I have been using docker through direct installation of Community Edition. Can anyone please let me know how to connect to local host after creating a docker container using my machines hostname?

Below is a picture of my hostname and the docker command I used for creating a containerenter image description here

  • 2
    The text (not image) output of ifconfig -a (on the Mac) or ip a (in the Docker thing) might be handy. – thrig Jun 21 '17 at 16:19

Do you mean that you want to connect to your mac from inside the docker container?

Generally speaking, you can just connect to any ip address that your mac has. It should be routable from inside the container. For example, if you run ifconfig, and see that your en0 interface has the ip address, then you can connect to your mac from inside a container at that address.

If you are running Docker For Mac edge, and you are on at least version 17.06.0-rc1-ce-mac13, then you should be able to resolve the following DNS name: docker.for.mac.localhost

It is expected that this will be in the stable branch once 17.06 hits stable.

You can see the note mentioning this dns name in the release notes here: https://docs.docker.com/docker-for-mac/release-notes/#docker-community-edition-17060-rc1-ce-mac13-2017-06-01-edge

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.