reach the localhost from inside docker-osx #306

Closed
opened 2025-12-29 00:23:51 +01:00 by adam · 4 comments
Owner

Originally created by @alexerisov on GitHub (Jan 17, 2022).

I wanna open localhost webserver in safari inside docker-osx. How can i do that?

Originally created by @alexerisov on GitHub (Jan 17, 2022). I wanna open localhost webserver in safari inside docker-osx. How can i do that?
adam closed this issue 2025-12-29 00:23:51 +01:00
Author
Owner

@sickcodes commented on GitHub (Jan 18, 2022):

Local webhost webserver example for safari inside Docker-OSX right here :)

https://github.com/sickcodes/Docker-OSX#forward-additional-ports-nginx-hosting-example

@sickcodes commented on GitHub (Jan 18, 2022): Local webhost webserver example for safari inside Docker-OSX right here :) https://github.com/sickcodes/Docker-OSX#forward-additional-ports-nginx-hosting-example
Author
Owner

@alexerisov commented on GitHub (Jan 18, 2022):

Yes, I've seen it, but this example describes how to start nginx in docker-osx and get it from localhost. But I wanna to start server on Local host and get it from inside docker-osx. I got problem that server and docker-osx require the same port on host machine. If I started server on 10024, Docker cannot start with same port. And if docker starts first, then server can't start.

@alexerisov commented on GitHub (Jan 18, 2022): Yes, I've seen it, but this example describes how to start nginx in docker-osx and get it from localhost. But I wanna to start server on Local host and get it from inside docker-osx. I got problem that server and docker-osx require the same port on host machine. If I started server on 10024, Docker cannot start with same port. And if docker starts first, then server can't start.
Author
Owner

@sickcodes commented on GitHub (Jan 20, 2022):

From inside the mac, you can reach 192.168.1.x naturally.

On host:
nginx will start on 80
ip addr will show all your IP's and bridges, which are localhost.

For me, I can visit the host on any of:

172.17.0.1
172.16.32.1
192.168.63.1
192.168.122.1
192.168.1.4

@sickcodes commented on GitHub (Jan 20, 2022): From inside the mac, you can reach 192.168.1.x naturally. On host: `nginx` will start on 80 `ip addr` will show all your IP's and bridges, which are localhost. For me, I can visit the host on any of: 172.17.0.1 172.16.32.1 192.168.63.1 192.168.122.1 192.168.1.4
Author
Owner

@alexerisov commented on GitHub (Jan 20, 2022):

Yep, It works. Thanks, you. I had tried 127.0.0.1:3000 and localhost:3000, and it had not worked. But as you advice 172.17.. and 192.168 works now. Thanks again )

@alexerisov commented on GitHub (Jan 20, 2022): Yep, It works. Thanks, you. I had tried 127.0.0.1:3000 and localhost:3000, and it had not worked. But as you advice 172.17.. and 192.168 works now. Thanks again )
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/Docker-OSX#306