Open Redis for Client with Docker

Allow to access all IP addresses in the server. 127.0.0.1 to 0.0.0.0 by modifying redis.conf

# bind 127.0.0.1
bind 0.0.0.0
# protected-mode yes
protected-mode no
FROM redis
RUN mkdir /redis_log

COPY redis.conf /usr/local/etc/redis/redis.conf
CMD [ "redis-server", "/usr/local/etc/redis/redis.conf" ]
import * as redis from "redis";
const client = redis.createClient("redis://redis_db");

client.on("error", function (error) {
  console.error(error);
});

client.set("key", "value", redis.print);
client.get("key", redis.print);
  • redis_db is redis container name
Reply: OK
Reply: value

https://stackoverflow.com/questions/19091087/open-redis-port-for-remote-connections

Leave a Reply

Your email address will not be published.

ANOTE.DEV