Failed to create/start container (Failed to bind: EADDRINUSE)

Expected behavior

Container is booted successfully while my local apache runs. It happens when my local apache is also running and using the same ports as the container (80 & 443)

Actual behavior

Starting db_1 Recreating web_1 ERROR: for web driver failed programming external connectivity on endpoint web_1 (3024c21b23bbfa26563d1a67f8ef892ce32f0383a79f5175a27d4c00e3a93766): Error starting userland proxy: Failed to bind: EADDRINUSE Traceback (most recent call last): File "<string>", line 3, in <module> File "compose/cli/", line 63, in main AttributeError: 'ProjectErr


pinata diagnose -u
OS X: version 10.11.3 (build: 15D21) version v1.11.1-beta12 Running diagnostic tests: [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/20160520-085720.tar.gz Most specific failure is: No error was detected Your unique id is: 06AD3F1F-EE7D-494B-AA87-BC20D78F447F Please quote this in all correspondence.
version: '2' services: db: image: environment: CLUSTER_NAME: xxx-xxx SSTUSER_PASSWD: xxx CLUSTER: xxx ROOTPASSWD: xxx volumes: - data:/var/lib/mysql ports: - "3306:3306" web: image: ports: - "80:80" - "443:443" links: - db volumes: - .:/home/app/myapp/xxx-xxx - ./ssl:/secrets/xxx/ - bundle:/home/app/myapp/bundle environment: DB_HOST_NAME: db DB_USER: root DB_PASSWORD: dockercompose PASSENGER_APP_ENV: development PING_SERVER: HTTP_AUTH: 'xxx_xxx@xxxx' volumes: bundle: {} data: {}

Steps to reproduce the behavior

  1. Start apache (or another service) that uses the same port as as the machine
  2. Start the container that has the same ports used for forwarding

More info

When in stop apache the container starts successfully. When using the brew version of Docker it works correct.

I’m running Version 1.12.1-rc1-beta23 (build: 11375) 2f0427ac7d4d47c705934ae141c3a248ed7fff40 - in my case, I have nginx on the host, but seeing (I think) the same issue.


docker run -it --rm -p 80:8080 nginx

Get the following error:

 Error starting userland proxy: Bind for unexpected error (Failure EADDRINUSE)

I believe the error is correct behavior. You cannot bind something to a port that’s already used.

I think it worked in the Brew version because it was the Toolbox version, the one that used a VirtualBox VM. In that version, it did not bind ports to the host but to the VM. Binding a container to port 80, it was the VM’s port 80, not the host’s port 80.

In the new version of Docker, bindings now happen on the host’s localhost which is correct behavior, hence why you’re seeing the errors.

Scratch that…massive user fail!