Sistason
Sistason

Reputation: 11

docker build fails with "address already in use"

docker build fails with "address already in use"

# docker build . --no-cache
Step 1/23 : FROM python:3.6
 ---> 8256ec07b2ad
Step 2/23 : ENV PYTHONUNBUFFERED 1
 ---> Running in 78555dd0c8cf
Removing intermediate container 78555dd0c8cf
 ---> ed07113d57c9
Step 3/23 : RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y apache2 apache2-utils apache2-dev
 ---> Running in 34b2929a0f8e
Address already in use

My /etc/docker/daemon.json is:

{
  "iptables": false,
  "bip": "172.16.0.1/24"
}

The docker0-interface exists normally

# ip a sh docker0
7: docker0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue state DOWN group default 
    link/ether 02:42:a1:8c:d4:4a brd ff:ff:ff:ff:ff:ff
    inet 172.16.0.1/24 brd 172.16.0.255 scope global docker0
       valid_lft forever preferred_lft forever

I got those on multiple hosts, restarting the docker daemon helps, but often only for the first build / first step using network.

I get that the error seems to be that a build-process is hogging the docker0-interface, probably, but I don't get why.

The error is not related to the daemon-options, I removed them to test. The packets never get into the docker0-interface (checked with iptables -vL), so it doesn't seem to be a firewalling issue (also since "address already in use" is a socket-error...)

Any ideas / suggestions?

edit:

FROM python:3.6
ENV PYTHONUNBUFFERED 1
RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y apache2 apache2-utils

edit2 docker-info:

# docker info
Containers: 20
 Running: 1
 Paused: 0
 Stopped: 19
Images: 105
Server Version: 18.06.1-ce
Storage Driver: aufs
 Root Dir: /var/lib/docker/aufs
 Backing Filesystem: extfs
 Dirs: 162
 Dirperm1 Supported: true
Logging Driver: json-file
Cgroup Driver: cgroupfs
Plugins:
 Volume: local
 Network: bridge host macvlan null overlay
 Log: awslogs fluentd gcplogs gelf journald json-file logentries splunk syslog
Swarm: inactive
Runtimes: runc
Default Runtime: runc
Init Binary: docker-init
containerd version: 468a545b9edcd5932818eb9de8e72413e616e86e
runc version: 69663f0bd4b60df09991c08812a60108003fa340
init version: fec3683
Security Options:
 apparmor
Kernel Version: 4.18.0-3-amd64
Operating System: Debian GNU/Linux buster/sid
OSType: linux
Architecture: x86_64
CPUs: 4
Total Memory: 7.677GiB
Name: 
ID: 
Docker Root Dir: /var/lib/docker
Debug Mode (client): false
Debug Mode (server): false
Registry: https://index.docker.io/v1/
Labels:
Experimental: false
Insecure Registries:
 127.0.0.0/8
Live Restore Enabled: false

WARNING: No swap limit support
WARNING: bridge-nf-call-iptables is disabled
WARNING: bridge-nf-call-ip6tables is disabled

Upvotes: 1

Views: 1101

Answers (2)

Divek John
Divek John

Reputation: 755

apache2 runs in the local network too, stop running the service or try maping different ports for apache2 in docker

Upvotes: 0

Jensen
Jensen

Reputation: 349

Might be because you are installing 2 versions of Apache. Try installing apache2 or apache2-dev, not both.

Upvotes: 0

Related Questions