Skip to content

Commit ad0f3f2

Browse files
committed
Update docker installation instructions
1 parent 8527dee commit ad0f3f2

File tree

1 file changed

+17
-65
lines changed
  • content/operate/oss_and_stack/install/install-stack

1 file changed

+17
-65
lines changed

content/operate/oss_and_stack/install/install-stack/docker.md

Lines changed: 17 additions & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -12,93 +12,45 @@ weight: 1
1212

1313
## Run Redis Community Edition (CE) on Docker
1414

15-
To get started with Redis CE using Docker, you first need to select a Docker image:
16-
17-
* `redis/redis-stack` contains both Redis Stack server and Redis Insight. This container is best for local development because you can use the embedded Redis Insight to visualize your data.
18-
19-
* `redis/redis-stack-server` provides Redis Stack server only. This container is best for production deployment.
20-
21-
## Getting started
22-
23-
### redis/redis-stack-server
24-
25-
To start Redis Stack server using the `redis-stack-server` image, run the following command in your terminal:
15+
To start Redis Community Edition server, using the `redis:<version>` image, run the following command in your terminal:
2616

2717
{{< highlight bash >}}
28-
docker run -d --name redis-stack-server -p 6379:6379 redis/redis-stack-server:latest
18+
docker run -d --name redis -p 6379:6379 redis:<version>
2919
{{< / highlight >}}
3020

31-
### redis/redis-stack
32-
33-
To start a Redis Stack container using the `redis-stack` image, run the following command in your terminal:
34-
35-
{{< highlight bash >}}
36-
docker run -d --name redis-stack -p 6379:6379 -p 8001:8001 redis/redis-stack:latest
37-
{{< / highlight >}}
38-
39-
The `docker run` command above also exposes Redis Insight on port 8001. You can use Redis Insight by pointing your browser to `localhost:8001`.
40-
4121
## Connect with redis-cli
4222

4323
You can then connect to the server using `redis-cli`, just as you connect to any Redis instance.
4424

4525
If you don’t have `redis-cli` installed locally, you can run it from the Docker container:
4626

4727
{{< highlight bash >}}
48-
$ docker exec -it redis-stack redis-cli
49-
{{< / highlight >}}
50-
51-
## Configuration
52-
53-
### Persistence in Docker
54-
55-
To mount directories or files to your Docker container, specify `-v` to configure a local volume. This command stores all data in the local directory `local-data`:
56-
{{< highlight bash >}}
57-
$ docker run -v /local-data/:/data redis/redis-stack:latest
58-
{{< / highlight >}}
59-
60-
### Ports
61-
62-
If you want to expose Redis Stack server or Redis Insight on a different port, update the left hand of portion of the `-p` argument. This command exposes Redis Stack server on port `10001` and Redis Insight on port `13333`:
63-
{{< highlight bash >}}
64-
$ docker run -p 10001:6379 -p 13333:8001 redis/redis-stack:latest
28+
$ docker exec -it redis redis-cli
6529
{{< / highlight >}}
6630

67-
### Config files
68-
69-
By default, the Redis Stack Docker containers use internal configuration files for Redis. To start Redis with local configuration file, you can use the `-v` volume options:
31+
If you do have `redis-cli` installed locally, you can run it from your terminal:
7032

7133
{{< highlight bash >}}
72-
$ docker run -v `pwd`/local-redis-stack.conf:/redis-stack.conf -p 6379:6379 -p 8001:8001 redis/redis-stack:latest
34+
$ redis-cli -h 127.0.0.1 -p 6379
7335
{{< / highlight >}}
7436

75-
### Environment variables
76-
77-
To pass in arbitrary configuration changes, you can set any of these environment variables:
78-
79-
* `REDIS_ARGS`: extra arguments for Redis
37+
## Use a local configuration file
8038

81-
* `REDISEARCH_ARGS`: arguments for the search and query features (RediSearch)
39+
By default, the Redis Docker containers use internal configuration files for Redis. To start Redis with local configuration file, you can do one of the following:
8240

83-
* `REDISJSON_ARGS`: arguments for JSON (RedisJSON)
41+
You can create your own Dockerfile that adds a `redis.conf` from the context into `/data/`, like so.
8442

85-
* `REDISTIMESERIES_ARGS`: arguments for time series (RedisTimeSeries)
86-
87-
* `REDISBLOOM_ARGS`: arguments for the probabilistic data structures (RedisBloom)
88-
89-
90-
For example, here's how to use the `REDIS_ARGS` environment variable to pass the `requirepass` directive to Redis:
43+
```
44+
FROM redis
45+
COPY redis.conf /usr/local/etc/redis/redis.conf
46+
CMD [ "redis-server", "/usr/local/etc/redis/redis.conf" ]
47+
```
48+
Alternatively, you can specify something along the same lines with docker run options.
9149

9250
{{< highlight bash >}}
93-
docker run -e REDIS_ARGS="--requirepass redis-stack" redis/redis-stack:latest
51+
$ docker run -v /myredis/conf:/usr/local/etc/redis --name myredis redis redis-server /usr/local/etc/redis/redis.conf
9452
{{< / highlight >}}
9553

96-
An example of setting [Redis persistence]({{< relref "/operate/oss_and_stack/management/persistence" >}}):
97-
{{< highlight bash >}}
98-
docker run -e REDIS_ARGS="--save 60 1000 --appendonly yes" redis/redis-stack:latest
99-
{{< / highlight >}}
54+
where `/myredis/conf/` is a local directory containing your `redis.conf` file. Using this method means that there is no need for you to have a Dockerfile for your redis container.
10055

101-
Here's how to set a retention policy for time series:
102-
{{< highlight bash >}}
103-
docker run -e REDISTIMESERIES_ARGS="RETENTION_POLICY=20" redis/redis-stack:latest
104-
{{< / highlight >}}
56+
The mapped directory should be writable, as depending on the configuration and mode of operation, Redis may need to create additional configuration files or rewrite existing ones.

0 commit comments

Comments
 (0)