Skip to main content
Stack Overflow
  1. About
  2. For Teams

Timeline for answer to How to access host port from docker container by Janne Annala

Current License: CC BY-SA 4.0

Post Revisions

26 events
when toggle format what by license comment
Feb 26, 2024 at 12:01 history edited EsmaeelE CC BY-SA 4.0
added 30 characters in body
Feb 26, 2024 at 11:14 history edited EsmaeelE CC BY-SA 4.0
added 54 characters in body
Oct 24, 2023 at 9:57 comment added rickstaa @janneAnnala Your solution worked like a charm—thanks! For those leveraging the UFW firewall with custom networks instead of the default bridge, don't forget to include the necessary allow rules. This ensures that the Docker container subnet can communicate with the host on your specified port.
Oct 18, 2023 at 13:45 comment added Janne Annala @joe you would never connect to the host. You would instead do whatever you need the host to accomplish on another container and connect to that.
Oct 9, 2023 at 4:08 comment added joe Is this host.docker.internal solution for production or not? If not , what should be used instead?
Apr 5, 2023 at 16:53 comment added Chris Stryczynski "does not work in a production environment outside of Docker Desktop." Surely this is incorrect? It does actually work without Docker Desktop.
Mar 15, 2023 at 13:42 history edited Janne Annala CC BY-SA 4.0
Update linux tips
Feb 9, 2023 at 20:54 comment added Jackson Mourão Love you... saved my @ss.
Sep 8, 2022 at 12:19 comment added Alan Plum This is the only way that worked for me on WSL with Docker for Windows.
Mar 9, 2022 at 21:29 comment added Paymahn Moghadasian I also needed to open up the port that I wanted to access on the host using the ubuntu firewall. Trying to figure out how to minimally open up this port since I don't want the whole world to have access to it...
Jun 24, 2021 at 15:57 comment added Albert Hidalgo host.docker.internal work perfect for me! in my case the WSL change the IP on every reboot :/
Dec 18, 2020 at 0:13 history edited Moshe Katz CC BY-SA 4.0
add Docker 20.10 for Linux instructions
Jun 27, 2019 at 5:24 comment added bluebinary I would second @junlin's comment here to add an entry to your host system's /etc/hosts file – 127.0.0.1 host.docker.internal – after I added this missing entry (and on macOS at least restarted mDNSResponder with sudo killall -HUP mDNSResponder to reload the changed hosts file), I was able to successfully connect to services running on my host machine from within Docker, where other approaches had not worked!
Jan 30, 2019 at 15:39 history edited Janne Annala CC BY-SA 4.0
edited body
Jun 19, 2018 at 11:14 comment added junlin Recommend use host.docker.internal in the docker container and config 127.0.0.1 host.docker.internal in hosts file.
Apr 15, 2018 at 19:42 history edited Janne Annala CC BY-SA 3.0
added 59 characters in body
Apr 15, 2018 at 19:39 comment added Janne Annala @SimonForsberg It's supposed to, but apparently it only works on Windows and macOS at the moment. There's an open ticket here github.com/docker/for-linux/issues/264
Apr 14, 2018 at 16:08 comment added Simon Forsberg Is host.docker.internal supposed to work also on Ubuntu? After having run docker run -it ubuntu:trusty bash the command root@40a5887b060d:/# ping host.docker.internal gives me ping: unknown host host.docker.internal
Mar 29, 2018 at 11:39 history edited Janne Annala CC BY-SA 3.0
Updated release date
Mar 27, 2018 at 12:17 comment added Snowball changed to host.docker.internal docs.docker.com/docker-for-mac/networking/…
Sep 25, 2017 at 14:57 comment added Rachel K. Westmacott docker.for.mac.localhost works nicely - except when using Chrome for browser testing (it disallows *.localhost referring to the host machine rather than the immediate container, as per: github.com/docker/for-mac/issues/1837). I found 192.168.65.1 worked instead.
Jul 5, 2017 at 18:18 history edited Janne Annala CC BY-SA 3.0
New solution
May 22, 2017 at 13:49 comment added alvaro g I've successfully tested this. No need to turn off the firewall
May 4, 2017 at 12:01 history edited Janne Annala CC BY-SA 3.0
deleted 9 characters in body
Apr 24, 2017 at 17:11 history edited Janne Annala CC BY-SA 3.0
Additional information
Apr 21, 2017 at 11:36 history answered Janne Annala CC BY-SA 3.0
toggle format

AltStyle によって変換されたページ (->オリジナル) /