Docker doesn't release port when stopping container

Expected behavior

When I stop a container that listens on port 5432, i should be able to start a new container that listens on port 5432

Actual behavior

when I stop a container that listens on port 5432, i cannot start a new container that listens on port 5432

Information

I get the following error when trying to start a new container that listens on port 5432 after stopping and removing a container that listens on port 5432 –

Error response from daemon: driver failed programming external connectivity on endpoint postgres: Error starting userland proxy: write /port/0.0.0.0:5432/ctl: errno 526

the only way I’ve found to resolve this is to restart Docker.

I’ve seen this as well. It appears that after some abitrary number of seconds, it does clean itself up and, in my case, using docker-compose, docker-compose up -d eventually works properly, the main difference being that it reports the container with the proxy issue is recreated.

@brandonkirchner do you know what your setting for native/port-forwarding is in pinata? This started happening for me when I switched that setting from false to true after the latest release.

I’m also getting this same behavior:

OS X 10.11.4

Version 1.11.0-beta8 (build: 6072)
3c1bfeb0e86a9403f82302edfea4c4987cc2cb32
% dockit.sh
docker: Error response from daemon: driver failed programming external connectivity on endpoint pedantic_bose (dcd447c9190db7270c58b3eb410d8a39071acbeb29b171ab938d0da47a49ce85): Error starting userland proxy: write /port/0.0.0.0:8000/ctl: errno 526.

% pinata diagnose -u 
OS X: version 10.11.4 (build: 15E65)
Docker.app: version v1.11.0-beta8.2
Running diagnostic tests:
[OK]      docker-cli
[OK]      Moby booted
[OK]      driver.amd64-linux
[OK]      vmnetd
[OK]      osxfs
[OK]      db
[OK]      slirp
[OK]      menubar
[OK]      environment
[OK]      Docker
[OK]      VT-x
Docker logs are being collected into /tmp/20160427-160034.tar.gz
Most specific failure is: No error was detected
Your unique id is: B6C27AE2-FB83-41A1-91B2-9386251C196A

I’m seeing a lot of these errors, even though I’m on the latest beta on a Mac — 1.11.1-beta10 , OS X 10.11.4. Restarting Docker works but is a pain.

Same thing here.

OS X 10.10.5
Version 1.11.1-beta11 (build: 6974)
37559e5f6acd56a4810963acc7001e88f2d88017