{"id":229,"date":"2020-01-26T11:39:06","date_gmt":"2020-01-26T11:39:06","guid":{"rendered":"http:\/\/tonysbit.blog\/?p=229"},"modified":"2020-01-26T11:39:06","modified_gmt":"2020-01-26T11:39:06","slug":"how-to-access-the-docker-host-from-a-docker-container","status":"publish","type":"post","link":"https:\/\/tonysbit.blog\/?p=229","title":{"rendered":"How to access the Docker host from a Docker container"},"content":{"rendered":"\n

<\/p>\n\n\n\n

There are situations where from a Docker container, you need to access services on the host machine. An example of this use-case is trying to test pdf-generation using a website hosted in your IDE environment from a container running on the same host pdf-bot<\/a>.<\/p>\n<\/div>\n\n\n\n

Summary<\/h1>\n

From Docker 18.04 on-wards there is a convenient internal DNS Entry (host.docker.internal<\/code>) accessible from your containers that will resolve to the internal network address of your host from your Docker container’s network.<\/p>\n

You can ping the host from within a container by running<\/p>\n

ping host.docker.internal<\/code><\/p>\n<\/div>\n\n\n\n

Proof<\/h1>\n

To test this feature using this guide you will need<\/p>\n