Search code examples
dockerconsul

Docker Swarm consul not starting


When I try to start docker consul by this command

docker run --restart=unless-stopped -d -p 8500:8500 -h consul progrium/consul -server -bootstrap

it gives the following error.

docker: Error response from daemon: driver failed programming external connectivity on endpoint tiny_bhaskara (b53c9aa988d96750bfff7c19c6717b18756c7b92287f0f7a4d9e9fa81f42c43d): iptables failed: iptables --wait -t nat -A DOCKER -p tcp -d 0/0 --dport 8500 -j DNAT --to-destination 172.17.0.2:8500 ! -i docker0: iptables: No chain/target/match by that name.

No idea what's going on!!


Solution

  • From this answer:

    Something on your system has removed the docker iptables entries that it needs to work. Two fixes have been suggested here:

    For CentOS:

    sudo service docker restart
    sudo service iptables save
    

    And for Ubuntu:

    sudo apt-get install iptables-persistent
    sudo service docker restart
    iptables-save > /etc/iptables/rules.v4 # you may need to "sudo -s" to get a root shell first
    

    After the restart of docker, you should see the docker chain under the nat table:

    iptables -t nat -vL