Skip to content

Docker for windows is not mapping ports to localhost #204

Closed
@panmanphil

Description

@panmanphil

Expected behavior

Using a simple example of the FROM microsoft/iis and EXPOSE 8000 as shown in the samples, this type of command runs, and I can access the port on the ip address shown from docker inspect. However when I use port mapping like so:

docker run -d -p 8080:8000 --rm iissite

I expect to be able to access the site from http:/localhost:8080, instead only the nat ip and EXPOSE port are reachable.

Actual behavior

unable to connect

Information

  • Diagnostic ID from "Diagnose & Feedback" in the menu.
  • a reproducible case if this is a bug, Dockerfiles FTW
  • page URL if this is a docs issue or the name of a man page
  • host distribution and version (Windows version, build number, etc)
    Client:
    Version: 1.12.0
    API version: 1.24
    Go version: go1.6.3
    Git commit: 8eab29e
    Built: Thu Jul 28 23:54:00 2016
    OS/Arch: linux/amd64

Server:
Version: 1.12.2-cs2-ws-beta
API version: 1.25
Go version: go1.7.1
Git commit: 050b611
Built: Tue Oct 11 02:35:40 2016
OS/Arch: windows/amd64

windows version 1607 build 14393.351

Dockerfile
FROM microsoft/iis
RUN mkdir C:\site
RUN powershell -NoProfile -Command
Import-module IISAdministration;
New-IISSite -Name "Site" -PhysicalPath C:\site -BindingInformation "*:8001:"
EXPOSE 8001
ADD . /site

Steps to reproduce the behavior

docker run -d --name site iissite
(from powershell)
docker inspect --format='{{.NetworkSettings.Networks.nat.IPAddress}}' site
wget "http://:8001" -UseBasicParsing
You see StatusCode 200

docker stop site
docker rm site
docker run -d -p 8080:8001 --name site iissite
wget "http://localhost:8080" -UseBasicParsing

get "unable to connect to the remote server"
also try trying the ip of ethernet0 from ip config

with linux containers and previous version of docker for windows, this works and works well

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions