add-host中的IP地址无效:“”+编程FILTER链失败:iptables失败
我正在使用另一个人在Docker容器中打包的科学代码。 我不是很熟悉容器,图像等背后的所有魔法。我只是通过运行一些简单的命令,如docker-compose up
或者docker-compose up --build
来使用它,如果我需要在代码中添加一些依赖关系的话。
所以一切都很正常,直到昨天晚上。 我正在运行一个模拟,花了整整一个晚上,但我看到结果不好,所以我只是杀死处理按ctrl + C
2或3次。 当我试图通过docker-compose up
再次启动模拟docker-compose up
了一个错误,不幸的是,我现在不记得了。 另外,奇怪的是 – 那一刻我无法连接到互联网。 我重新启动,互联网再次正常工作,我试图再次运行docker-compose up
,我得到了以下输出:
WARNING: The DOCKERHOST variable is not set. Defaulting to a blank string. Creating alcor_alcor_1 ... alcor_cassandra_1 is up-to-date Creating alcor_alcor_1 ... error ERROR: for alcor_alcor_1 Cannot create container for service alcor: invalid IP address in add-host: "" ERROR: for alcor Cannot create container for service alcor: invalid IP address in add-host: "" ERROR: Encountered errors while bringing up the project.
我通过运行删除了所有的图像,容器和卷:
docker rm $(docker ps -a -f status=exited -q)
docker rmi $(docker images -a -q)
docker volume rm $(docker volume ls -f dangling=true -q)
然后我通过运行docker-compose build --no-cache
重build所有东西
没有错误被抛出。 我再次运行docker-compose up
,仍然得到了同样的错误: invalid IP address in add-host: ""
然后我再次重复我的步骤:删除所有的图像,容器和卷,重build一切,并试图再次运行。 现在每次它都显示出这个:
WARNING: The DOCKERHOST variable is not set. Defaulting to a blank string. Creating network "alcor_default" with the default driver ERROR: Failed to program FILTER chain: iptables failed: iptables -I FORWARD -o br-231cf5f5b939 -j DOCKER: iptables v1.4.14: Couldn't load target `DOCKER':No such file or directory Try `iptables -h' or 'iptables --help' for more information. (exit status 2)
这可能是什么原因,如何解决? 我可以提供任何其他信息来帮助理解吗? Google和Docker文档在这个问题上没有说什么。 我没有发现任何关于它的事情。 任何帮助表示赞赏。
这是可能有助于理解这个问题的东西:
$ docker version Client: Version: 17.06.0-ce API version: 1.30 Go version: go1.8.3 Git commit: 02c1d87 Built: Fri Jun 23 21:27:03 2017 OS/Arch: linux/amd64 Server: Version: 17.06.0-ce API version: 1.30 (minimum version 1.12) Go version: go1.8.3 Git commit: 02c1d87 Built: Fri Jun 23 21:22:34 2017 OS/Arch: linux/amd64 Experimental: false
泊坞窗,compose.yml
version: '3' services: alcor: build: . image: lycantropos/alcor:latest entrypoint: "/alcor/docker-entrypoint.sh" volumes: - .:/alcor/ extra_hosts: - "dockerhost:$DOCKERHOST" # for debugging command: # Here I omitted many options and arguments - simulate environment: - CASSANDRA_RPC_ADDRESS=cassandra - CASSANDRA_RPC_PORT=9042 cassandra: image: cassandra:latest volumes: - cassandra-data:/var/lib/cassandra volumes: cassandra-data:
编辑:我再试一次。 我清理了一切,重新启动和重build,并返回第一个错误。
在docker-compose.yml中更改该行
- "dockerhost:$DOCKERHOST" # for debugging
至
- "dockerhost:172.17.0.1"
解决了这个问题。
编辑:我在另一台计算机上有类似的问题。 运行以下命令有助于:
sudo systemctl restart docker