Invalid IP address on secondary host: "" + Failed to program FILTER chain: iptables failed
I am working with scientific code that was packaged in Docker containers by another person. I'm not very good at all the magic behind containers, images, etc. And I only used it by running some simple commands like docker-compose up
or docker-compose up --build
if I needed to add some dependencies in the code. So until the last night everything was completely normal. I was running a simulation that ran all night, but I saw that the results were not very good, so I just killed the processed one by pressing ctrl + C
2 or 3 times. When I tried to run the simulation again docker-compose up
, I got an error that, unfortunately, I canβt remember now. Also, the strange thing is that at that moment I could not connect to the Internet. I rebooted, internet worked fine again, I tried to run againdocker-compose up
and I got the following output:
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.
I removed all images, containers and volumes by running: 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)
And then I rebuilt everything by doing: docker-compose build --no-cache
There were no errors. I ran again docker-compose up
and still got the same error: invalid IP address in add-host: ""
Then I repeated my steps again: deleted all images, containers and volumes, restored everything and tried to start again. Now every time this shows me this:
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)
What could be causing this and how to solve it? Can I provide more information to help understand this? Google docs and Docker don't say anything about this. And I didn't know anything about it. Any help is appreciated.
Here's what might help you understand the problem:
$ 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
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:
Edit: I tried again. I cleared everything, rebooted and rebuilt and the first error came back.
source to share
First of all, in docker-compose.yml, I had to change the line
- "dockerhost:$DOCKERHOST" # for debugging
in
- "dockerhost:172.17.0.1"
where 172.17.0.1 is the so-called bridged network gateway .
This did not completely solve the second error issue. But the following commands helped:
sudo ufw disable
sudo systemctl restart docker
where the first one disables the firewall.
It looks like it was an Ubuntu-specific issue, as I never had this issue on Linux Mint and very rarely on Debian Wheezy.
source to share