2

I have following docker-compose.yml redis config.

version: '3.5'

services:
  db:
    image: redis:latest
    command: redis-server --bind 0.0.0.0 --appendonly yes --protected-mode no

    ports:
      - target: 6379
        published: 6379
        protocol: tcp
        mode: ingress

There are two hosts leader-0 (manager) and redis-0 (worker)

> root@leader-0:~# docker node ls
ID                            HOSTNAME               STATUS     
46tmallxr4l8xr7i90vlwntjq *   leader-0               Ready               
mofbedj4sqlxgnyatbxhlokc7     redis-0                Ready               

Redis host redis-0 exposes 6379 port on the localhost as expected:

> root@redis-0:~# redis-cli -h 127.0.0.1 ping
PONG

but 6379 is not available on the manager (although it should):

> root@leader-0:~# redis-cli -h 127.0.0.1 ping
Could not connect to Redis at 127.0.0.1:6379: Connection timed out

Interesting part is:

  1. Connection timed out (not refused).
  2. redis-cli -h 127.0.0.1 ping on other workers hosts works as expected (returns PONG).

Docker overlay mash network should expose 6379 port on the local interface on each host, but it looks like something went wrong and I messed up figuring out what exactly.

Other services on the manager host works properly (I can curl http://localhost:${SERVICE_PORT}/).

Manager host has the same firewall rules as worker hosts (+ additional ports opened)

Alex T
  • 4,331
  • 3
  • 29
  • 47

0 Answers0