How to connect to Redis inside Docker on a remote server?

Hi there,

I have an app deployed to a remote server with Docker + Redis. I’m trying to connect to the remote hosted Redis database to use a GUI. I managed to connect locally with the help of the community but how do I connect on a remote server?

Using the remote server ip and normal port (6379) is just returning with a connection refused error.

Maybe your remote Redis server require credentials?

See:

Due to security reasons, the Redis port is not published on the external IP, so you get connection refused. You need to use SSH tunneling and connect to localhost. I’m not sure if it’s published to localhost (127.0.0.1) either, you might need to modify the docker-compose file of that target to publish the port

Thanks @Apple! Even though this is remote, I still need to connect to localhost? and not the IP of the remote server? I am at level 0 when it comes to SSH tunnelling, so i’ll have to figure that out if it’s the only way. Thank you for the guidance.

@George I just tried that connection string but the same issue remains - plus, I assume I actually need to set the password somewhere? this isn’t creating the password?

Hi @mgaussie,

SSH tunneling allows you to establish a secure connection to your server through SSH. You connect to your server’s IP address for the SSH tunnel, but then the Redis connection connects to localhost, because you’re already inside a tunnel. It’s like you’re in front of your server (like in front of your computer) and you connect to localhost

SSH tunneling should be a feature of your Redis client of choice

This is a really great explanation - thank you!

Ok, that’s clear. It doesn’t look like this service has SSH but I’ll dig deeper now I have a better understanding.

Where is your Redis server running? Did you setup it yourself or is it a managed database like the one from Digital Ocean?

The Redis Server is in my Docker Container. I used Wappler to set it up. It’s not external to the container or a managed database. The remote server (with my docker container) is on Digital Ocean.