I have tried all the possible solutions available on either StackOverflow or other forums, that I could find. I begin installing redis with docker by actual instructions available on Hub Docker. But I was not able to connect to Redis outside container.
My initial command:
docker run --name c-redis -d redis
After further searching I found that I needed to execute it as:
docker run --name mag-redis -d redis -p 6379:6379
But this failed as well, as I got the following error.
$ docker run --name c-redis -d redis -p 6379:6379 c2dbf68f52b46e90671a7efaafbe46898368bb" Unable to find image 'redis:latest' locally latest: Pulling from library/redis 8559a31e96f4: Already exists 85a6a5c53ff0: Already exists b69876b7abed: Already exists a72d84b9df6a: Already exists 5ce7b314b19c: Already exists 04c4bfb0b023: Already exists Digest: sha256:800f2587bf3376cb01e6307afe599ddce9439deafbd4fb8562829da96085c9c5 Status: Downloaded newer image for redis:latest 075d68ec71abf3752050c947e44a4b1c52305fb6153febe815e31659284612cf docker: Error response from daemon: driver failed programming external connectivity on endpoint c-redis (f251e744aeacbd1a084f11b0e01731b1e1a36454ca8ad634889dd38dae66314d): (iptables failed: iptables --wait -t nat -A DOCKER -p tcp -d 0/0 --dport 6379 -j DNAT --to-destination 172.17.0.3:6379 ! -i docker0: iptables: No chain/target/match by that name. (exit status 1)).
I then restarted
iptables as one of the solutions available online was this. But this did not help, and same error again. I then found another query on Stackoverflow i.e.
docker run --name c-redis -p 6379:6379 -d redis --restart unless-stopped -v /etc/redis/:/data --appendonly yes --requirepass "password"
However, same error of iptables… I then removed the image/container, and executed with first command
(docker run --name c-redis -d redis), it redis was installed but again I was not able to access to externally (by the same host, outside container).
I again removed the container/image, and tried those other 2 commands, but each time I was having same iptables error, I even tried to reboot the docker. Still no use.
I am using Centos 7. Please let me know if anyone else faced such issue. I am totally stuck here for the past several hour(s).
docker: Error response from daemon: driver failed programming external
connectivity on endpoint c-redis
(iptables failed: iptables –wait -t nat -A DOCKER -p tcp -d 0/0
–dport 6379 -j DNAT –to-destination 172.17.0.3:6379 ! -i docker0: iptables: No chain/target/match by that name. (exit status 1)).
Client: Docker Engine - Community Version: 19.03.12 API version: 1.40 Go version: go1.13.10 Git commit: 48a66213fe Built: Mon Jun 22 15:46:54 2020 OS/Arch: linux/amd64 Experimental: false Server: Docker Engine - Community Engine: Version: 19.03.12 API version: 1.40 (minimum version 1.12) Go version: go1.13.10 Git commit: 48a66213fe Built: Mon Jun 22 15:45:28 2020 OS/Arch: linux/amd64 Experimental: false containerd: Version: 1.2.13 GitCommit: 7ad184331fa3e55e52b890ea95e65ba581ae3429 runc: Version: 1.0.0-rc10 GitCommit: dc9208a3303feef5b3839f4323d9beb36df0a9dd docker-init: Version: 0.18.0 GitCommit: fec3683