Skip to content

Cannot start service service-name: driver failed programming external connectivity on endpoint container-name: Error starting userland proxy: listen tcp <ip>:port: bind: cannot assign requested address #8106

Closed
@messutied

Description

@messutied

Description of the issue

Error when running docker-compose with port bind to external IP address.

Looks related to #3277 but running systemctl restart docker as advised there did not help.

Context information (for bug reports)

Output of docker-compose version

docker-compose version 1.18.0, build 8dd22a9
docker-py version: 2.6.1
CPython version: 2.7.13
OpenSSL version: OpenSSL 1.0.1t  3 May 2016

Output of docker version

Client: Docker Engine - Community
 Version:           20.10.0
 API version:       1.41
 Go version:        go1.13.15
 Git commit:        7287ab3
 Built:             Tue Dec  8 18:59:53 2020
 OS/Arch:           linux/amd64
 Context:           default
 Experimental:      true

Server: Docker Engine - Community
 Engine:
  Version:          20.10.0
  API version:      1.41 (minimum version 1.12)
  Go version:       go1.13.15
  Git commit:       eeddea2
  Built:            Tue Dec  8 18:57:44 2020
  OS/Arch:          linux/amd64
  Experimental:     false
 containerd:
  Version:          1.4.3
  GitCommit:        269548fa27e0089a8b8278fc4fc781d7f65a939b
 runc:
  Version:          1.0.0-rc92
  GitCommit:        ff819c7e9184c13b7c2607fe6c30ae19403a7aff
 docker-init:
  Version:          0.19.0
  GitCommit:        de40ad0

Output of docker-compose config
(Make sure to add the relevant -f and other flags)

services:
  postgres:
    image: postgres:9.5
    ports:
    - 127.0.0.1:5432:5432/tcp
    volumes:
  statushq:
    depends_on:
    - postgres
    environment:
      ...
    image: messutiedd/statushq
    ports:
    - 5000:5000/tcp
    - <ip>:4369:4369/tcp
    - 9001:9001/tcp
    - 25:2525/tcp
    restart: always
    volumes:
    ...

Steps to reproduce the issue

  1. Change a port bind in docker-compose.yaml from 4369:4369 to <ip>:4369:4369 (<ip> is a real life external IP which should be the only one with allowed access to that port).
  2. Run docker-compose up

Observed result

docker-compose errors and container fails to start.

Expected result

Container should start successfully and allow connections only on the given IP.

Stacktrace / full error message

Recreating 35e93f062be7_35e93f062be7_docker_statushq_1 ... error

ERROR: for 35e93f062be7_35e93f062be7_docker_statushq_1  Cannot start service statushq: driver failed programming external connectivity on endpoint docker_statushq_1 (79fe33198b8b1933c14706d0bc81dabcfc48111df4fca90d6c2a532a13da28de): Error starting userland proxy: listen tcp <ip>:4369: bind: cannot assign requested address

ERROR: for statushq  Cannot start service statushq: driver failed programming external connectivity on endpoint docker_statushq_1 (79fe33198b8b1933c14706d0bc81dabcfc48111df4fca90d6c2a532a13da28de): Error starting userland proxy: listen tcp <ip>:4369: bind: cannot assign requested address
ERROR: Encountered errors while bringing up the project.

Additional information

OS version / distribution, docker-compose install method, etc.

Ubuntu 20.04.2 LTS (GNU/Linux 5.4.0-65-generic x86_64)
docker-compose installed through docker-ce package

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