docker 构建失败,并显示“地址已在使用中”
# 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
我的/etc/docker/daemon.json是:
{
"iptables": false,
"bip": "172.16.0.1/24"
}
docker0接口正常存在
# 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
我将它们放在多台主机上,重新启动docker守护进程会有所帮助,但通常仅适用于使用网络进行的第一个构建/第一步。
我知道错误似乎可能是构建过程在占用docker0接口,但我不明白为什么。
该错误与守护程序选项无关,我将其删除以进行测试。 数据包永远不会进入docker0接口(已通过iptables -vL检查),因此这似乎不是防火墙问题(也是因为“地址已在使用中”是套接字错误...)
有什么想法/建议吗?
编辑:
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
答案 0 :(得分:0)
可能是因为您要安装2个版本的Apache。尝试安装apache2或apache2-dev,而不是两者。