Skip to content

"driver failed programming external connectivity on endpoint" (1.7.0-rc1) #3277

Description

@jamshid

I'm pretty sure this was working on docker-compose 1.7.0-rc1 before I installed the latest Docker for Mac beta, which upgraded to docker 1.11.0-rc3. I'm trying to get the socat service to run on port 172.17.0.1:8123, so that it's available to docker builds. My real yml uses an environment variable for the IP address, but it happens even when hardcoded.

ERROR: for socat_httpcache  driver failed programming external connectivity on endpoint test_socat_httpcache_1 (5d973ed559d63a5561b715248f797a336915a44960b5e32e622ac8349b16e5d2): Error starting userland proxy: failed to bind port: Unix.Unix_error(Unix.EADDRNOTAVAIL, "bind", "")
version: '2'
services:
  httpcache:
    restart: always
    image: clue/polipo
    command: proxyAddress=0.0.0.0 allowedClients=0.0.0.0/0 disableIndexing=false disableServersList=false
    mem_limit: 500m
    memswap_limit: 500m
    volumes:
      - /var/cache/polipo

  socat_httpcache:
    restart: always
    hostname: POLIPO1
    image: bobrik/socat
    mem_limit: 50m
    command: TCP-LISTEN:8123,fork,reuseaddr TCP:httpcache:8123
    depends_on:
      - httpcache
    ports:
      - "172.17.0.1:8123:8123"

verbose.txt

Activity

  1. aboch commented on Apr 6, 2016

    @aboch

    @jamshid
    Can you post the o/p of sudo netstat -nlp | grep 8123. Thanks.

  2. jamshid commented on Apr 6, 2016

    @jamshid
    Author

    My mac says -p requires an argument, so I think this is what you want:

    $ sudo netstat -nl -p tcp  | grep 8123
    (nothing)
    $ sudo netstat -nl -p tcp  | head    # to confirm mac output is what you expect
    Active Internet connections
    Proto Recv-Q Send-Q  Local Address          Foreign Address        (state)    
    tcp4       0      0  192.168.2.4.52918      216.58.194.34.80       ESTABLISHED
    tcp4       0      0  192.168.2.4.52917      23.199.236.147.80      ESTABLISHED
    tcp4       0      0  192.168.2.4.52916      192.229.163.25.443     ESTABLISHED
    tcp4       0      0  192.168.2.4.52915      192.229.163.175.80     ESTABLISHED
    ...
    $ docker ps -a | grep 8123
    7baf5b2ec0eb        clue/polipo               "polipo proxyAddress="   26 minutes ago      Up 12 minutes                  8123/tcp            test_httpcache_1
    3fea15e3d5b4        clue/polipo               "polipo proxyAddress="   33 minutes ago      Up 19 minutes                  8123/tcp            buildenv_httpcache_1
    
  3. bezelga commented on Apr 29, 2016

    @bezelga

    same thing happening to me.

  4. leeahoward commented on May 3, 2016

    @leeahoward

    I am getting the same issue when restarting using docker-compose up. In my case it's an nginx proxy service that fails to start. Must be related to the Docker for Mac beta. It started after I installed the beta and hasn't happened after switching back over to Virtualbox.

    docker-compose version 1.7.0, build 0d7bf73
    Docker version 1.11.0, build 4dc5990

  5. elghazal-a commented on May 4, 2016

    @elghazal-a

    I encouner the same error when I try to start my stack using docker-compose. All the containers start correctly except one (consul). I'm getting this error

    ERROR: for consul driver failed programming external connectivity on endpoint devas_consul_1 (6ceba32c51cb70b354f 2f4b68d173ca97a65d6a0bfd308d3137e2a7069abd1b6): Error starting userland proxy: Failed to bind: EADDRNOTAVAIL

    I'm sure it has something to do with my docker version beta for mac.

    docker-compose -v docker-compose version 1.7.0, build 0d7bf73

    I'm using the last docker beta version for mac

    `
    docker version
    Client:
    Version: 1.11.1
    API version: 1.23
    Go version: go1.5.4
    Git commit: 5604cbe
    Built: Wed Apr 27 00:34:20 2016
    OS/Arch: darwin/amd64

    Server:
    Version: 1.11.1
    API version: 1.23
    Go version: go1.5.4
    Git commit: 8b63c77
    Built: Fri Apr 29 14:13:26 2016
    OS/Arch: linux/amd64
    `

  6. zh4ngx commented on May 5, 2016

    @zh4ngx

    Following the above message, I get Error starting userland proxy: Failed to bind: EADDRINUSE.
    Confused as to where the conflict is where none existed before

  7. mattgi commented on May 7, 2016

    @mattgi

    How does one "release" the port that is in use so that compose can bring up the container again? First time it happened, I waited for a minute or so and it worked on second attempt. Second time, its been about an hour. Docker compose kill, down, rm --all, etc. and something still has a hold of it.

  8. mattgi commented on May 7, 2016

    @mattgi
  9. elghazal-a commented on May 13, 2016

    @elghazal-a

    I figure out what the problem is about, the container (consul) causing the issue has this binding port 172.17.0.1:53:8600/udp. I replaced it with 53:8600/udp and it's working now. I didn't understand yet why the first binding doesn't work. BTW, How can I know the bridge ip address?

  10. rsilveira65 commented on May 30, 2016

    @rsilveira65

    Hello, I had the same problem with Docker version 1.11.1 on Mac OSX.
    ERROR: for nginx driver failed programming external connectivity on endpoint managercentralapp_nginx_1 (e11d19ee8f486a2e12c9c87802dca7ea5f541f026645f69e338e94732ac1eb56): Error starting userland proxy: Failed to bind: EADDRINUSE

  11. madjam002 commented on Jun 20, 2016

    @madjam002

    I too am getting this after upgrading to Docker 1.12-rc2, not sure if this is the right place to post this.

    Client:
     Version:      1.12.0-rc2
     API version:  1.24
     Go version:   go1.6.2
     Git commit:   906eacd
     Built:        Fri Jun 17 20:35:33 2016
     OS/Arch:      darwin/amd64
     Experimental: true
    
    Server:
     Version:      1.12.0-rc2
     API version:  1.24
     Go version:   go1.6.2
     Git commit:   906eacd-unsupported
     Built:        Fri Jun 17 21:12:28 2016
     OS/Arch:      linux/amd64
     Experimental: true
    
  12. madjam002 commented on Jun 21, 2016

    @madjam002

    Full error:

    Error response from daemon: driver failed programming external connectivity on endpoint xxx_xxx_1 (xxx): Bind for 0.0.0.0:2224 failed: port is already allocated
    

    netstat:

    tcp6       0      0 :::2224                 :::*                    LISTEN      9083/docker-proxy
    
  13. deg commented on Jun 22, 2016

    @deg

    I'm seeing this sporadically. Retrying the command after a minute usually "fixes" the problem.
    This is after moving to Docker for Mac yesterday.

    $ docker version
    Client:
     Version:      1.12.0-rc2
     API version:  1.24
     Go version:   go1.6.2
     Git commit:   906eacd
     Built:        Fri Jun 17 20:35:33 2016
     OS/Arch:      darwin/amd64
     Experimental: true
    
    Server:
     Version:      1.12.0-rc2
     API version:  1.24
     Go version:   go1.6.2
     Git commit:   a7119de
     Built:        Fri Jun 17 22:09:20 2016
     OS/Arch:      linux/amd64
     Experimental: true
    
    
  14. kausik93 commented on Jun 29, 2016

    @kausik93

    I've also been getting the same error as you guys. I believed it was because nginx was binding it ports that were already taken up but I don't think so now. Did anyone find any solutions to this? :)

  15. 280 remaining items

  16. wsw70 commented on Apr 17, 2021

    @wsw70

    @dmtanner thank you very much for your comment.

    After upgrading packages on my system and rebooting I was stuck with docker trying to connect to IPv6 despite being disabled on my system.

    Downgrading helped, the command is (in case someone is desperate and in a hurry)

    apt install docker-ce=5:19.03.15~3-0~ubuntu-bionic
    systemctl stop docker
    systemctl start docker
    

    EDIT: I did not realize that the issue was opened in 2016...

    In my case the problem is definitely with IPv6: up to and including version 19 the fact that it is disabled on my system was handled correctly, I upgraded today to 20.something and random issues with containers not starting because of that happened.
    Downgrading fixed everything (there were no changes in the configuration of the containers).
    I did not have messages about the "HOST being already used ...", just

    ERROR: for 0aa9cd2e88ae_mqtt Cannot start service mqtt: driver failed programming external connectivity on endpoint mqtt (7123295e1d2a17d53a88c9847db30deac6888dcd6a27f7901b0b8a3dedff2cb6): Error starting userland proxy: listen tcp6 [::]:8883: socket: address family not supported by protocol

  17. gjolund commented on Apr 22, 2021

    @gjolund

    Ubuntu 20, Docker version 20.10.6, build 370c289

    Updated docker and now getting this error, rolled back and resolved the issue.

    Definitely and issue with the current docker release.

    Cannot start service postgres: driver failed programming external connectivity on endpoint tradebinder_postgres_1 (8333460cee3dffb87b736b2af62c06ba0ffef7b28ca765ee686a9681d38ef66d): Error starting userland proxy: listen tcp6 [::]:5432: socket: address family not supported by protocol
  18. reneolivo commented on Apr 27, 2021

    @reneolivo

    MacOS user here. This problem usually happens randomly to me. No processes on the troubled port. Not even a single container, no vbox virtual machine up, nothing.

    Restarting didn't fix anything. Updating and restarting the Docker service using the Docker Desktop app fixed the issue. Not sure if this will fix the issue in the future.

  19. liqin-z commented on May 14, 2021

    @liqin-z

    Ubuntu 20.04 here, the error message was

    Error response from daemon: driver failed programming external connectivity on endpoint nginx (b05d13ec7f7c76e6cb4e1bbec142a5655d875477c081e71371179cda80efadb0): Error starting userland proxy: listen tcp4 0.0.0.0:80: bind: address already in use
    Error: failed to start containers: nginx

    To resolve this issue, I used sudo netstat -plant | grep 80 and found that apache is using the port, and then I just typed sudo systemctl stop apache2.service.

    Hope it helps.

  20. gjolund commented on May 14, 2021

    @gjolund

    The same error is thrown when the port is occupied, but for users experiencing this issue who have confirmed the port is unoccupied it is more complicated.

    The underlying issue is due to a breaking change introduced in Docker version 20.10.6 that breaks networking for devices that don't have ipv6 enabled.

    The only solution is rolling back to 20.10.5 until a fix is published.

    For additional info see here docker/for-linux#1233

    Instructions on how to rollback and blacklist release 20.10.6 docker/for-linux#1233 (comment)

  21. CodingNagger commented on Jun 9, 2021

    @CodingNagger

    Unfortunately running into the same issue today, running a Postgres container. Port in use error but the port isn't used, ran all the diagnostic commands I could find to verify this. Restarting the Mac didn't change anything. No way to rollback to the previous version, however, killing docker and restarting it with the following command seems to have fixed the issue:

    killall Docker && open /Applications/Docker.app
    
  22. snogrammer commented on Jun 10, 2021

    @snogrammer

    @CodingNagger same for me. I just updated to 3.4.0 and seems to be working for the time being, but keeping your command ready since force killing it seems to be the only way to get my containers to run.

  23. robin-blanchard commented on Jun 15, 2021

    @robin-blanchard

    Ran into this issue today. Tried many of the commands above, nothing worked.
    Looking into netstat showed no process running on the same port. Launching the container on another port led to the same error.
    Rebooting fixed the issue.

  24. kokizzu commented on Jun 18, 2021

    @kokizzu

    ran this issue today
    same port (9000) used by another program/docker
    stopping all other docker on docker ps and the service (probably systemctl stop clickhouse-server) works

  25. PRodO5lNk5 commented on Oct 18, 2021

    @PRodO5lNk5

    I had the same issue which was caused by my local php8 instance (local apache2 server took over the address)
    sudo systemctl stop apache2.service Solved it.

  26. buckbeak99 commented on Apr 23, 2022

    @buckbeak99

    ERROR: for aa8d9522c8a3_fusion-chain-home-automation_client_1 Cannot start service client: driver failed programming external connectivity on endpoint fusion-chain-home-automation_client_1 (4156e28b67d576875589737c68273ab5cb3a1106cce29555cf2596e75386d2ef): Error starting userland proxy: listen tcp4 0.0.0.0:4200: bind: address already in use
    I can't solve this error. Can anybody help me?
    Thanks In Advance

  27. renepardon commented on Apr 23, 2022

    @renepardon

    ERROR: for aa8d9522c8a3_fusion-chain-home-automation_client_1 Cannot start service client: driver failed programming external connectivity on endpoint fusion-chain-home-automation_client_1 (4156e28b67d576875589737c68273ab5cb3a1106cce29555cf2596e75386d2ef): Error starting userland proxy: listen tcp4 0.0.0.0:4200: bind: address already in use
    I can't solve this error. Can anybody help me?
    Thanks In Advance

    As your error states: something is already running on port 4200.

  28. davidcsi commented on Apr 23, 2022

    @davidcsi
  29. morales2k commented on Apr 23, 2022

    @morales2k

    @buckbeak99 If you already restarted the docker service, and this is still popping up, then yes, something else (other than your docker containers) is taking that port number.

    Sometimes docker ends up in a weird state where the containers are down but the networks are up and you cannot raise your containers because the ports are taken. Restarting the docker service should clear this issue.

  30. buckbeak99 commented on Apr 23, 2022

    @buckbeak99

    Thank you, @morales2k, and @davidcsi. After restarting my laptop, the error is solved completely. Thanks again for your precious advice.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions