Docker Community Forums

Share and learn in the Docker community.

Expose container ports on localhost not working

Expected behavior

When I try to map a port from container to localhost, it’s suppose to work.

Actual behavior

Docker for Windows (1.12.0-rc3-beta18 b 5193) returns an error when I try to run a container with -p argument.

λ docker run -d -p 80:80 --name webserver nginx
Unable to find image 'nginx:latest' locally
latest: Pulling from library/nginx

51f5c6a04d83: Pull complete
a3ed95caeb02: Pull complete
51d229e136d0: Pull complete
bcd41daec8cc: Pull complete
Digest: sha256:0fe6413f3e30fcc5920bc8fa769280975b10b1c26721de956e1428b9e2f29d04
Status: Downloaded newer image for nginx:latest
bf83d00191ab094d350bb98e3bf08f2e57d8537d93180d45bdc0ea5bd7483a71
docker: Error response from daemon: driver failed programming external connectivity on endpoint webserver (1126556fd2ac7779c12a8e7eab79f104a0d7f4b18d4ca85e9113ee1198729bf2): Error starting userland proxy: write /port/tcp:0.0.0.0:80:tcp:172.17.0.2:80/ctl: errno 526.

Information

  • Diagnose ID CB8C3B08-EDDE-42BF-A29B-E0B1004C4F14/2016-07-05_19-29-46
  • Windows 10 build 1511

Steps to reproduce the behavior

  1. Installed Docker for Windows beta with default options.
  2. Run docker run -d -p 80:80 --name webserver nginx suggested by docs.
1 Like

I just tested with Beta 18 and was not able to reproduce the error.
Did you have the settings set to expose localhost in Beta 17?

Can you try disabling the localhost setting in Network settings? It might also be good to try a different port than 80 in case you already have a process bound there.

Michael

Tried to debug a little more and worked in a different port:

docker run -d -p 8080:80 --name webserver nginx

IIS Express service was using port 80. My bad :slight_smile:

1 Like

Thanks for reporting this - I’ve created an issue to track improving the error message.

1 Like

FWIW, also had problems with “Expose container ports on localhost”

I’m using postgresql and I start having this error:
“error 08p01 invalid message format”

Disabling this experiment functionality “solved” the problem

Using Docker for Windows 1.12.0-rc4-beta19 build 5465

A diagnostic was uploaded with id: D7E2026D-F959-4B2A-A636-9D38762FD9A6/2016-07-18_10-28-12

try command: docker-machine ls
and run using url ip address: http://{virtual-machine ip}:{exposed port}