linux – docker-compose在添加veth(虚拟接口)桥接docker0时失败
问题:这是我的docker-compose.yaml:
version: '2'
services:
elasticsearch:
image: 'elasticsearch:latest'
ports:
- "9200:9200"
logstash:
build: './logstash_image'
links:
- elasticsearch
ports:
- "5000:5000"
- "5001:5001"
- "5201:5201"
- "5202:5202"
- "5203:5203"
kibana:
image: 'kibana:latest'
ports:
- '5601:5601'
links:
- elasticsearch
volumes:
- ./kibana.yml:/opt/kibana/config/kibana.yml
这是我的Dockerfile:
FROM logstash:latest
LABEL maintainer1.name="anon" \
maintainer1.email="anon@mail.com" \
maintainer2.name="myname" \
maintainer2.email="myname@somemail.com"
RUN /opt/logstash/bin/logstash-plugin install logstash-input-log4j2-logstash2 logstash-output-syslog
# FIX: use `logstash-input-log4j2` instead of `logstash-input-log4j2-logstash2`?
# other plugins: logstash-input-http, logstash-input-log4j
COPY logstash.conf /etc/logstash/conf.d/logstash.conf
ENTRYPOINT ["logstash","-f","/etc/logstash/conf.d/logstash.conf", "--debug"]
这用于几天前建立就好,但是目前我收到以下错误消息:
[root@somemachine elk_stack]# docker-compose up -d
Creating network "elkstack_default" with the default driver
Building logstash
Step 1 : FROM logstash:latest
---> 1ca34df702f8
Step 2 : LABEL maintainer1.name ...
---> Using cache
---> 6dd78ac216f2
Step 3 : RUN /opt/logstash/bin/logstash-plugin install logstash-input-log4j2-logstash2 logstash-output-syslog
---> Running in 885b0429b3a4
ERROR: Service 'logstash' failed to build: failed to create endpoint focused_almeida on network bridge: adding interface veth0491201 to bridge docker0 failed: operation not supported
错误:服务“logstash”无法构建:无法在网桥上创建端点focused_almeida:添加接口veth0491201以桥接docker0失败:操作不受支持
所以似乎(1)docker-compose正在为logstash服务而不是elkstack_logstash_1分配一个随机生成的名称,大概是因为compose没有完全通过.(2)veth0491201由于某种原因无法连接到网桥docker0,因此我无法从容器内到达互联网,因为它没有通过docker0连接.
调查:在撰写之后的docker ps -a:
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
885b0429b3a4 6dd78ac216f2 "/bin/sh -c '/opt/log" 18 minutes ago Created focused_almeida
建模后的码头网络ls:
NETWORK ID NAME DRIVER
23bcc8c01ad4 bridge bridge
4aea66903c6b none null
67cb26c508d9 host host
9fc4a42bbcf6 elkstack_default bridge
docker network inspect elkstack_default:
[
{
"Name": "elkstack_default",
"Id": "9fc4a42bbcf6800889f8e9bc71ab394ebf6f97b21e0ce2345253b055d17138aa",
"Scope": "local",
"Driver": "bridge",
"IPAM": {
"Driver": "default",
"Options": null,
"Config": [
{
"Subnet": "172.19.0.0/16",
"Gateway": "172.19.0.1/16"
}
]
},
"Containers": {},
"Options": {}
}
]
路线-n:
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
0.0.0.0 10.0.120.1 0.0.0.0 UG 100 0 0 docker0
10.0.120.0 0.0.0.0 255.255.255.0 U 100 0 0 docker0
172.17.0.0 0.0.0.0 255.255.0.0 U 0 0 0 br-83e64c848669
172.19.0.0 0.0.0.0 255.255.0.0 U 0 0 0 br-9fc4a42bbcf6
故障排除线索
> docker –version:Docker版本1.10.2,构建c3959b1docker-compose –version:docker-compose版本1.8.0,build f3628c7Docker中的一些网络错误?>我正在执行此操作的计算机最近对其网络,防火墙等进行了一些配置更改.我认为它使用172.18.0.0用于其他东西,所以当Docker尝试使用该路由时它会被阻止.如何排除故障或确定机器网络设置是否存在问题?>继续(2)中提出的观点,我试图建立一个docker-compose,其中明确定义了网络,这似乎也不起作用:
06007
>我能够在机器上构建另一堆服务,这让我相信它是与Docker相关或与docker-compose相关的缺陷,无论是在应用程序本身还是在我的配置中.>我能够在本地机器上运行这个,这让我相信这是我遇到问题的远程机器的问题.
uname -a:Linux somemachine 3.10.0-327.10.1.el7.x86_64#1 SMP Tue 2月16日17:03:50 UTC 2016 x86_64 x86_64 x86_64 GNU / Linuxcat / etc / centos-release:CentOS Linux发行版7.2.1511(核心版)
相关信息&问题: – http://54.71.194.30:4017/articles/networking/#how-docker-networks-a-container – https://github.com/docker/docker/issues/23047 – https://github.com/docker/docker/issues/15341