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?
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
192.168.20.32, 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:
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