Geo*_*rgy 6 host docker docker-compose
我正在使用由另一个人打包在 Docker 容器中的科学代码。我不太熟悉容器、图像等背后的所有魔力。我只是通过运行一些简单的命令来使用它,例如docker-compose up或者docker-compose up --build如果我需要在代码中添加一些依赖项。
所以直到昨晚一切都很正常。我正在运行一个模拟,花了整整一个晚上,但我发现结果不太好,所以我只是通过按ctrl + C2 或 3 次来终止处理。当我尝试再次启动模拟时,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.
Run Code Online (Sandbox Code Playgroud)
我通过运行以下命令删除了所有图像、容器和卷:
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
没有抛出任何错误。我再次运行docker-compose up,仍然遇到相同的错误:invalid IP address in add-host: ""
然后我再次重复我的步骤:删除所有图像、容器和卷,重建所有内容并尝试再次运行。现在每次它都会向我展示这个:
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)
Run Code Online (Sandbox Code Playgroud)
这可能是什么原因以及如何解决?我可以提供任何其他信息来帮助理解这一点吗?Google 和 Docker 文档没有就此事发表任何言论。我在 SO 上没有找到任何关于它的信息。任何帮助表示赞赏。
以下内容可能有助于理解该问题:
$ 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
Run Code Online (Sandbox Code Playgroud)
docker-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:
Run Code Online (Sandbox Code Playgroud)
编辑:我又试了一次。我清理了所有内容,重新启动并重建,然后返回了第一个错误。
首先,在docker-compose.yml中我必须更改该行
- "dockerhost:$DOCKERHOST" # for debugging
Run Code Online (Sandbox Code Playgroud)
到
- "dockerhost:172.17.0.1"
Run Code Online (Sandbox Code Playgroud)
其中172.17.0.1是所谓的桥接网络网关。
并没有完全解决第二个错误的问题。但有帮助的是运行以下命令:
sudo ufw disable
sudo systemctl restart docker
Run Code Online (Sandbox Code Playgroud)
其中第一个禁用防火墙。
看起来这是 Ubuntu 特有的问题,因为我在 Linux Mint 上从未遇到过这个问题,而在 Debian Wheezy 上则很少发生。
| 归档时间: |
|
| 查看次数: |
24574 次 |
| 最近记录: |