Lesson 17 / 28

Container-to-Host Communication

Reach services on your host from a container, and remember that localhost inside a container means the container.

By · 15 years in web development · Updated 1 Oct 2026

host.docker.internal

From inside a container, localhost refers to the container itself, not your host machine. Use the special DNS name host.docker.internal to reach services running on your host.