moby: Error when try to start nginx container (Bind for 0.0.0.0:80 failed: port is already allocated.)

Output of docker version:

Client:
 Version:      1.12.1
 API version:  1.24
 Go version:   go1.6.3
 Git commit:   23cf638
 Built:        Thu Aug 18 05:33:38 2016
 OS/Arch:      linux/amd64

Server:
 Version:      1.12.1
 API version:  1.24
 Go version:   go1.6.3
 Git commit:   23cf638
 Built:        Thu Aug 18 05:33:38 2016
 OS/Arch:      linux/amd64

Output of docker info:

Containers: 12
 Running: 0
 Paused: 0
 Stopped: 12
Images: 96
Server Version: 1.12.1
Storage Driver: aufs
 Root Dir: /var/lib/docker/aufs
 Backing Filesystem: extfs
 Dirs: 265
 Dirperm1 Supported: true
Logging Driver: json-file
Cgroup Driver: cgroupfs
Plugins:
 Volume: local
 Network: bridge host null overlay
Swarm: inactive
Runtimes: runc
Default Runtime: runc
Security Options: apparmor seccomp
Kernel Version: 4.4.0-34-generic
Operating System: Ubuntu 16.04.1 LTS
OSType: linux
Architecture: x86_64
CPUs: 2
Total Memory: 7.698 GiB
Name: flaker-Lenovo-G580
ID: MJHR:SASW:4PLV:Z6UN:2CGY:UYUX:PNMK:GR4A:UMT4:QMAL:N553:QMT3
Docker Root Dir: /var/lib/docker
Debug Mode (client): false
Debug Mode (server): false
Username: furdarius
Registry: https://index.docker.io/v1/
WARNING: No swap limit support
Insecure Registries:
 127.0.0.0/8

Additional environment details (AWS, VirtualBox, physical, etc.):

Native on Ubuntu 16.04.1

Steps to reproduce the issue:

This behavior appears after updating docker-engine on 1.12.1

  1. After starting the OS docker-proxy listen 80 and 443 ports (IS IT RIGHT BEHAVIOR???)
$ sudo netstat -nlp | grep 80
tcp6       0      0 :::80                   :::*                    LISTEN      5059/docker-proxy
$ sudo netstat -nlp | grep 443
tcp6       0      0 :::443                  :::*                    LISTEN      4901/docker-proxy
  1. So, when i try to start nginx, get error:
$ docker run -d -p 80:80 nginx:lateste5649c0a87d8b65a453dad0d6ed1d47333d8b12ddfe69d1069efac5a2d71a305
docker: Error response from daemon: driver failed programming external connectivity on endpoint loving_shockley (19e43dd9ead43ab52bd15e548d3f9fd62d88955da2acff50b92316306245fdee): Bind for 0.0.0.0:80 failed: port is already allocated.
  1. Okay, let’s try to kill docker-proxy
  2. Now, ports (80 and 443) aren’t listening
$ sudo netstat -nlp | grep 443
$ sudo netstat -nlp | grep 80
  1. But, when i trying to start nginx again, same result
$ docker run -d -p 80:80 nginx:latest
70e5868169349d1f0a25f54d08e37f7f80f36cc8ad5ce30eae5c0e5808b15027
docker: Error response from daemon: driver failed programming external connectivity on endpoint sharp_bose (70766b94e756ead0efafd508a6465cb00267a942318db78e6398d5a966834d24): Bind for 0.0.0.0:80 failed: port is already allocated.

About this issue

  • Original URL
  • State: closed
  • Created 8 years ago
  • Comments: 23 (7 by maintainers)

Most upvoted comments

same problem here. I removed all container (even stop container) and didn’t work.

Can other people check if they had the same issue as @foxos42 - an old kv db - it seems like certainly one way this could happen.