Docker Community Forums

Share and learn in the Docker community.

Can not bind port 62374


(Djui) #1

I have the same symptom (EADDRINUSE) as described in Port mappings are not released however, for a different root case and even before having started any container:

$ docker ps
CONTAINER ID        IMAGE               COMMAND             CREATED             STATUS              PORTS               NAMES

$ docker run --rm -p 62374:62374 alpine sh
docker: Error response from daemon: driver failed programming external connectivity on endpoint desperate_swirles (35f4a1f10d9936897d428c99654a912f6947c42becca13f62dfb5fa2ae0cfa25): Error starting userland proxy: listen tcp 0.0.0.0:62374: bind: address already in use.


$ docker run --pid=host --net host --rm -it alpine sh
/ # netstat -tnlp
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name
tcp        0      0 :::62374                :::*                    LISTEN      -
tcp        0      0 :::2375                 :::*                    LISTEN      -

I understand that port 2375 is the docker daemon, but I can’t find any reference to port 62374. So when starting any container that needs to bind port 62374 (or a docker-compose manifest with a range of ports including this one) it fails with:

ERROR: for frontend  driver failed programming external connectivity on endpoint myservice_1 (7a4f7ab3ec3be4b8a8b317d0630aaf4516dce71c303bf15b14266da77c2dc35a): Error starting userland proxy: listen tcp 0.0.0.0:62374: bind: address already in use

It’s at least interesting that I can’t even find a reference to it when using ps nor lsof in the container nor on my host.

$ lsof -n -P -i -s 'TCP:LISTEN'
COMMAND    PID USER   FD   TYPE             DEVICE SIZE/OFF NODE NAME
UserEvent  283  uwe    4u  IPv4 0xb4ae9943322499d1      0t0  UDP *:*
SystemUIS  328  uwe    9u  IPv4 0xb4ae994332249769      0t0  UDP *:*
SystemUIS  328  uwe   10u  IPv4 0xb4ae994332247f59      0t0  UDP *:*
SystemUIS  328  uwe   13u  IPv4 0xb4ae99433224a371      0t0  UDP *:53372
SystemUIS  328  uwe   15u  IPv4 0xb4ae99433224a841      0t0  UDP *:*
sharingd   339  uwe   12u  IPv4 0xb4ae994334cb80e9      0t0  UDP *:*
sharingd   339  uwe   16u  IPv4 0xb4ae994332249c39      0t0  UDP *:*
2BUA8C4S2  924  uwe   13u  IPv4 0xb4ae99434085fd51      0t0  TCP 127.0.0.1:6258 (LISTEN)
2BUA8C4S2  924  uwe   14u  IPv6 0xb4ae994332faaf19      0t0  TCP [::1]:6258 (LISTEN)
2BUA8C4S2  924  uwe   15u  IPv4 0xb4ae994340860659      0t0  TCP 127.0.0.1:6263 (LISTEN)
2BUA8C4S2  924  uwe   16u  IPv6 0xb4ae99433d259979      0t0  TCP [::1]:6263 (LISTEN)
WiFiAgent  948  uwe    7u  IPv4 0xb4ae994334b01109      0t0  UDP *:*
Dropbox    995  uwe   62u  IPv6 0xb4ae99433d274ed9      0t0  TCP *:17500 (LISTEN)
Dropbox    995  uwe   69u  IPv4 0xb4ae994343479f61      0t0  TCP *:17500 (LISTEN)
Dropbox    995  uwe   82u  IPv4 0xb4ae994340a9fcf1      0t0  UDP *:17500
Dropbox    995  uwe   88u  IPv4 0xb4ae994343481d51      0t0  TCP 127.0.0.1:17600 (LISTEN)
Dropbox    995  uwe   97u  IPv4 0xb4ae994342a61449      0t0  TCP 127.0.0.1:17603 (LISTEN)
com.docke 1128  uwe   11u  IPv4 0xb4ae994334cb9691      0t0  UDP *:54814
SpotifyWe 1205  uwe    6u  IPv4 0xb4ae994342966659      0t0  TCP 127.0.0.1:4370 (LISTEN)
SpotifyWe 1205  uwe    7u  IPv4 0xb4ae994342965d51      0t0  TCP 127.0.0.1:4380 (LISTEN)
/ # lsof -n -P -i
2571	/bin/busybox	/0
2571	/bin/busybox	/0
2571	/bin/busybox	/0
2571	/bin/busybox	/dev/tty
$ ps aux | grep 62374
$
/ # ps aux | grep 62374
/ #

This was not the case in beta <=8 iirc and could be since VPN mode was used / set by default.

Could you elaborate why this port is bound and by what?


(Djui) #2

Some additional information:

$ pinata get native/port-forwarding
true

$ pinata list
These are advanced configuration settings to customise Docker.app on MacOSX.
You can set them via pinata set <key> <value> <options>.

🐳  hostname = docker
   Hostname of the virtual machine endpoint, where container ports will be
   exposed if using nat networking. Access it via 'docker.local'.

🐳  hypervisor = native (memory=2, ncpu=4)
   The Docker.app includes embedded hypervisors that run the virtual machines
   that power the containers. This setting allows you to control which the
   default one used for Linux is.

 ▸  native: a version of the xhyve hypervisor that uses the MacOSX
              Hypervisor.framework to run container VMs. Parameters:
              memory (VM memory in gigabytes), ncpu (vCPUs)


🐳  network = hostnet (docker-ipv4=192.168.65.2, host-ipv4=192.168.65.1)
   Controls how local containers can access the external network via the
   MacOS X host. This includes outbound traffic as well as publishing ports
   for external access to the local containers.

 ▸ hostnet: a mode that helps if you are using a VPN that restricts
              connectivity. Activating this mode will proxy container network
              packets via the Docker.app process as host socket traffic.
              Parameters: docker-ipv4 (docker node), host-ipv4 (host node)
 ▸     nat: a mode that uses the MacOS X vmnet.framework to route container
              traffic to the host network via a NAT.

🐳  filesystem = osxfs
   Controls the mode by which files from the MacOS X host and the container
   filesystem are shared with each other.

 ▸   osxfs: a FUSE-based filesystem that bidirectionally forwards OSX
              filesystem events into the container.


🐳  native/port-forwarding = true
   Expose container ports on the Mac, rather than the VM

 ▸    true: Container ports will be exposed on the Mac
 ▸   false: Container ports will be exposed on the VM

🐳  daemon = run 'pinata get daemon' or 'pinata set daemon [@file|-]'
   JSON configuration of the local Docker daemon. Configure any custom
   options you need as documented in:
   https://docs.docker.com/engine/reference/commandline/daemon/. Set it
   directly, or a @file or - for stdin.

$ pinata diagnose
OS X: version 10.11.4 (build: 15E65)
Docker.app: version v1.11.1-beta10
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/20160506-102311.tar.gz
Most specific failure is: No error was detected
Would you like to upload log files? [Y/n]: y

Your unique id is: 8AEDF010-6050-48C0-8FA5-909CB31C6E32
Please quote this in all correspondence.

(Djui) #3

Seems like I found out what process (diagnostics-server) bind that port:

$ screen ~/Library/Containers/com.docker.docker/Data/com.docker.driver.amd64-linux/tty
docker login: root
Welcome to the Moby alpha, based on Alpine Linux.
docker:~# netstat -tulpn
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name
tcp        0      0 :::62374                :::*                    LISTEN      1504/diagnostics-se
tcp        0      0 :::2375                 :::*                    LISTEN      1269/docker
udp        0      0 127.0.0.1:323           0.0.0.0:*                           1295/chronyd
udp        0      0 ::1:323                 :::*                                1295/chronyd