If you encounter the error messages shown below when attempting to run docker-compose up
in OCI, a solution to the problem can be found in the following steps:
failed to create network traefik_default: Error response from daemon: Failed to program FILTER chain: iptables failed: iptables --wait -I FORWARD -o br-5501386794d6 -j DOCKER: iptables v1.8.4 (legacy): Couldn't load target `DOCKER':No such file or directory
Try `iptables -h' or 'iptables --help' for more information.
(exit status 2)
or
Error response from daemon: driver failed programming external connectivity on endpoint traefik (...): (iptables failed: iptables --wait -t filter -A DOCKER ! -i br-9091a9bdxxx0 -o br-9091a9bdxxx0 -p tcp -d 172.21.0.2 --dport 443 -j ACCEPT: iptables: No chain/target/match by that name. (exit status 1))
These error messages you encountered indicate that the target module DOCKER
is not available or loaded in your version of iptables. The DOCKER
target module is utilized to enable communication between Docker containers and the host system’s network stack.
It is possible that the Docker-related modules are not properly installed or configured on your system. Here are a few troubleshooting steps you can try:
1. Check iptables version
Verify that you have a version of iptables that supports the DOCKER
target. Versions earlier than iptables 1.6.0
may not include the DOCKER target
. You can check your iptables version by running the command iptables --version
.
2. Enable Docker-related modules
Ensure that the necessary Docker-related modules are loaded. You can use the following command to load the required modules:
sudo modprobe ip_tables
sudo modprobe iptable_filter
sudo modprobe iptable_nat
sudo modprobe nf_conntrack
3. Restart Docker and iptables service
Try restarting both the Docker service and the iptables service to ensure they are running correctly. Use the following commands to restart the services:
sudo systemctl restart docker
sudo service iptables restart
4. Reinstall Docker
If the issue persists, you may need to reinstall Docker to ensure all necessary components are properly configured. Before doing so, make sure to back up any important data or configurations related to Docker. (It is not recommended to take this step unless it is deemed necessary as a last resort).
If this post helped you to solve a problem or provided you with new insights, please upvote it and share your experience in the comments below. Your comments can help others who may be facing similar challenges. Thank you!