0

I want to run a docker container in my server, and expose a specific port to other server in the same intranet. But I don't want my container can be accessed by internet outside.

Is there any solution for my situation?

Any help will be appreciated.

morphinewan
  • 434
  • 2
  • 6
  • 17

1 Answers1

0

If your host computer is running on Windows, you can configure firewall to allow that specific port to be accessed only from that machine. Another option is to configure boot2docker (via iptables) to restrict access only to specific IP address. But I think it works only for the current session: you have to edit boot2docker image and add it to be used permanently. And the drawback is that all docker images running in docker inside boot2docker would be affected with this change.

So, my suggestion is to restrict access on host computer side, such as:

c:\>boot2docker init
c:\>boot2docker up
c:\>boot2docker ssh -L 0.0.0.0:8080:localhost:8080
docker@boot2docker:~$ docker run -p 8080:8080 myContainer

And restrict port 8080 on firewall level of your host computer.

Magic Wand
  • 1,572
  • 10
  • 9