我正在使用以下系统:
[alexus@wcmisdlin02 Desktop]$ rpm -q docker docker-1.9.1-25.el7.centos.x86_64 [alexus@wcmisdlin02 Desktop]$ cat /etc/redhat-release CentOS Linux release 7.2.1511 (Core) [alexus@wcmisdlin02 Desktop]$ uname -a Linux wcmisdlin02.uftmasterad.org 3.10.0-327.13.1.el7.x86_64 #1 SMP Thu Mar 31 16:04:38 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux [alexus@wcmisdlin02 Desktop]$
我指的是撰写文件参考 docker-compose.yml语法:
[alexus@wcmisdlin02 Desktop]$ cat docker-compose.yml nginx: container_name: nginx image: nginx ports: - "80:80" [alexus@wcmisdlin02 Desktop]$ docker-compose up Creating nginx ERROR: for nginx Cannot start container fcaba40fb21cc64f514d71eb8117ba0f2102482be6e74615e96261667403a236: failed to create endpoint nginx on network bridge: COMMAND_FAILED: '/sbin/iptables -w2 -t nat -A DOCKER -p tcp -d 0/0 --dport 80 -j DNAT --to-destination 172.17.0.2:80 ! -i docker0' failed: iptables: No chain/target/match by that name. Attaching to [alexus@wcmisdlin02 Desktop]$
如果我删除docker-compose.yml ports部分,容器启动,但显然networking没有设置我需要的方式。
我需要nginx容器开始侦听主机上的端口80。
我究竟做错了什么?
iptables: No chain/target/match by that name.
你系统上的东西删除了Docker的iptables规则。 可以通过重新启动Docker服务来重新创build它们。
我猜测有一个错误,因为我再次尝试,现在它正在工作。 我没有更新docker包到最新版本:
[alexus@wcmisdlin02 ~]$ rpm -q docker docker-1.10.3-44.el7.centos.x86_64 [alexus@wcmisdlin02 ~]$