Docker Community Forums

Share and learn in the Docker community.

Accessing Container from the local Network

docker

(Aaronsturm) #1

I apologize if this isn’t the correct forum for this question. I’m trying to run a media server container and I’m unsure how to access it from my local home network. I set the network_mode to host so that all of the container’s ports would be open.

Here is my Compose file:
version: '2’
volumes:
server-exe:
driver: local
config:
driver: local
services:
emby:
image: emby/embyserver
container_name: emby
network_mode: "host"
volumes:
- config:/config
- /e/Users/Aaron/OneDrive/TV Shows/New:/shows
- server-exe:/target

I’m able to access the web interface using http://docker:8096 on my local machine, but not on another computer on the same network.

Information

Docker version 1.11.0, build 4dc5990
Windows 10

My system’s IP: 192.168.1.8

$ ping docker

Pinging docker [10.0.75.2] with 32 bytes of data:
Reply from 10.0.75.2: bytes=32 time<1ms TTL=64

Any help would be appreciated!! Thanks!


Accessing Windows 10 Hyper V Docker instance from external
(Bfhobbes) #2

I was able to achieve this using port forwarding. For instance :
netsh interface portproxy add v4tov4 listenport=80 connectaddress=10.0.75.2 connectport=32771 protocol=tcp

Where port 32771 was the port on the docker host. I was then able to connect from other machines on my network at my desktops ip and port 80

If you don’t use 80 you’ll probably have to set up a firewall rule in Windows firewall


(Andymac4182) #3

Would anyone use a local service that manages this for you? It would listen to the docker events and add and remove the relevant port forwards. I thought docker beta would of done this but shouldn’t be too hard to add something over the top to manage this.


(Bfhobbes) #4

It looks like they’ve addressed the issue in a recent version. I’m on 1.11.2-beta15, and just tried out the new experimental “Expose container ports on localhost” and it appears to be working perfectly for me so far.


(Aaronsturm) #5

Thanks for the follow-up @bfhobbes. Can you point me to the docs? I’m not finding it.


(Aaronsturm) #6

Nevermind, found it here: https://beta.docker.com/docs/windows/release-notes/


(Michael Friis) #7

It’s in the latest betas


(Aaronsturm) #8

Will that only bind to 127.0.0.1? If so, then that won’t fix my issue as I need it accessible on the network. Thanks.


(Kgersen) #9

it binds to 0.0.0.0 so all interfaces of the host. ofc then, on Windows host, you have to open the port(s) in the firewall.

I tried:

docker run -d -p 80:80 kitematic/hello-world-nginx

it was accessible from the network once allowed in the firewall.


(Aaronsturm) #10

Can’t believe I forgot the firewall! Once I opened the port in the firewall it worked as expected. Thanks all!