Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.Sign up
port exposure on windows = ? #15740
port exposure on windows = ?
Windows (7) with Docker (version 1.8.1, build d12ea79):
has no results on the host machine. If I point my browser to
it results in:
even though I am told it is serving:
I also tried other variants:
they all do work - but have zero effects on Windows.
I also tried the same thing on Linux:
and it works perfectly. The browser shows:
What can I do to create a server that will work platform independent, short term?
My goal is to wrap my chaincountdown into a docker container, and the docker solution is targeted mainly at Windows users - because on Linux my server is so easy to start anyways.
Docker is great, my first day, and I am already loving it! Just the windows version seems to have quite some issues.
Thanks a lot!
$ docker version
$ docker info
$ uname -a
The reason you're having this, is because on Linux, the docker daemon (and your containers) run on the Linux machine itself, so "localhost" is also the host that the container is running on, and the ports are mapped to.
On Windows (and OS X), the docker daemon, and your containers cannot run natively, so only the docker client is running on your Windows machine, but the daemon (and your containers) run in a VirtualBox Virtual Machine, that runs Linux.
To connect to the container, you must connect to the IP-address of the virtual machine, not of your Windows computer.
This is all described in the Windows installation documentation, found here; http://docs.docker.com/installation/windows/.
The Virtual Machine is described in this section; http://docs.docker.com/installation/windows/#learn-the-key-concepts-before-installing
And an explanation on how to map ports, and connect to them is explained here; http://docs.docker.com/installation/windows/#container-port-redirection
I'm going to close this issue, because this is not a bug, and explained in the documentation. I hope the above explanation helps you. Feel free to comment here after I've closed this issue.
Thanks a lot. That was fast. I am a bit disappointed, that Docker is not platform independent in such a basic question. But what you wrote, actually fixed my problem. Thanks!
Alright then ... I would then have to write this manual for my users (for foobar assuming it were nginx which it is not):
if you are on Windows:
then open the browser at:
if you are on Linux:
Is that correct?
Does anyone has ideas how that could be made more platform independent?
(Perhaps leave this issue open?)
Thanks anyways. Enjoy whatever you do.
Yes, that description is correct. To make things easier, you could have a look at kitematic, which also can be installed with Docker Toolbox, and provides an easy to use interface for this (with clickable links to directly open the website in your browser). Kitematic only runs on Windows and Mac currently.
Unfortunately, we cannot make this behavior more consistent, because the docker-daemon (Docker Engine) cannot run natively on Windows or OS X, so the virtual machine is a requirement to make it possible to run it.
Work is in progress to run Docker Engine natively on Windows Server 2016, but that engine will only run Windows applications, not Linux
That is so sad.
Then I make a bold move - I suggest a new command for Dockerfiles:
when that command is found in a Dockerfile, it gets completely ignored on a Linux machine;
It would be used like this:
and would probably then cause some magic with the Virtualbox-Ethernet-Adapters.
Voilà - platform independence could be -almost- regained.
What do you think?
The documented way to do port forwarding does not appear to be working for me on windows:
So then i switch over to my browser, and navigate to http://192.168.99.100, which comes up with ERR_CONNECTION_REFUSED
For good measure, I try:
@dajester2013 that's because you're not publishing any port of the container, so the containers' ports will only be accessible on the "internal" (inter-container) network. Look at the
Hope this helps!
I am having the same issue.
Trying to navigate to http://192.168.99.100:5000/api/values results in ERR_CONNECTION_REFUSED
Solution for Windows hosts
Here's my Nginx server running on 80 port (for example):
All you need is just add port forwarding (admin rights required):
You may change addresses and ports as you need.
@thaJeztah Somewhere above, you mentioned
But I am having the problems even on Windows 2016 TP4. I have written a very detailed problem description here:
(I had followed the instructions https://msdn.microsoft.com/en-us/virtualization/windowscontainers/quick_start/inplace_setup ("Setup an existing Virtual Machine or Bare Metal host for Containers") prior to running the docker container, where I use the "bare metal host", no hyper-V)
For what it's worth, the solution by @dnemoga works quite well. Just some more info to round out the process:
Adding a port proxy (the command used above):
Showing all existing port proxies:
Deleting the same port proxy:
Open the VirtualBox Manager, choose the docker image (e.g. "default"), click "Settings" on the toolbar, switch to "Network" tab, choose "Adapter 1" tab (the "NAT"), extend "Advanced", click "Port Forwarding", add the port as your need.
@thaJeztah Did you close this because either mapping the IP is impossible or undesirable? This was horribly confusing for me. I expected the behavior of docker to be identical on windows, max, and linux. That's part of the point right? Vagrant has no problem mapping localhost into a virtual machine, so why does docker?
If its possible to make this mapping work, can you please reopen this issue?
@fresheneesz With Docker for Windows, Linux containers with mapped ports are available on
Also, I prefer to use Docker Toolbox on Windows regardless, as I often want to run other things in Virtualbox (and I can't feasibly use Virtualbox and Hyper-V without rebooting between).
Description of problem/solution: I am running Docker Toolbox on Windows 10 Home, because you can't run regular Dockers for Windows on a non-Windows-Pro machine. All components came up, but I couldn't access the website. Entering the IP or domain name in a browser or curl command resulted in a
One specific thing to know about our setup is we have a virtual host name, which let's say is "domayne.moc". All requests on port 80 get forwarded with a 301 redirect to the SSL version of our server, or "https://domayne.moc" (on port 443). Requests to the docker virtual machine IP (192.168.99.100:80, get yours with
By creating rules in Windows' netsh interface portproxy to forward these domain-port combinations to the docker VM IP, Windows figures out where to send the requests. I'm curious if I should have edited the hosts file to forward to the docker VM instead of "127.0.0.1". I'll test that later.
The specific commands were:
Edit: Editing the hosts file worked just as well.
A few valuable things I learned when trying to make docker on windows work with localhost is that multiple network devices or other network releated devices might affect the localhost to interface binding.
Had some laptops where disabling "Wifi Switch" in BIOS solved the issue and made docker stable in allowing connections to localhost.
Consider testing by disabling all but your cabled network card in bios to see if any issue stem from these devices.
Weather or not its somethings that has to be fixed within Docker or maybe Windows itself is still unknown, was unable to capture traffic related to the issue on any interfaces, so debugging / stepping within the network core of docker / windows is needed to assign responsibility :)