From a9ffb9509fea75ca0bda8a81c9b76dea099df943 Mon Sep 17 00:00:00 2001 From: Simon Kok Date: Tue, 28 May 2019 12:56:10 +0200 Subject: [PATCH] Fixed docs to showcase how to connect to the redis server locally and from a redis-cli container --- redis/content.md | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/redis/content.md b/redis/content.md index f1f3723ea803..2351cb4e72cf 100644 --- a/redis/content.md +++ b/redis/content.md @@ -14,6 +14,12 @@ Redis is an open-source, networked, in-memory, key-value data store with optiona $ docker run --name some-redis -d %%IMAGE%% ``` +Connect to it locally on your machine: + +```console +$ docker run --name some-redis -p 127.0.0.1:6379:6379 -d %%IMAGE%% +``` + ## start with persistent storage ```console @@ -26,10 +32,24 @@ For more about Redis Persistence, see [http://redis.io/topics/persistence](http: ## connecting via `redis-cli` +Create the network first: + ```console -$ docker run -it --network some-network --rm %%IMAGE%% redis-cli -h some-redis +$ docker network create some-network +``` + +Start the server in the same network, see `--network` argument: + +```console +$ docker run --name some-redis --network some-network -d %%IMAGE%% ``` +Run the `redis-cli` in a docker container in the same network: + +```console +$ docker run -it --network some-network --rm %%IMAGE%% redis-cli -h some-redis +`` + ## Additionally, If you want to use your own redis.conf ... You can create your own Dockerfile that adds a redis.conf from the context into /data/, like so.