Skip to content

Commit 7ad68ca

Browse files
committed
update README.md
1 parent 359442a commit 7ad68ca

File tree

4 files changed

+58
-0
lines changed

4 files changed

+58
-0
lines changed
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
devpassword

.gitignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
*.idea
2+
*.vscode
3+
*.env
4+
*.redis_pass_file
5+

README.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,23 @@
11
# redis
22
Simple Redis service
3+
4+
### Setup password
5+
to set `Redis` password ,just put password value at
6+
`.docker-compose/` directory as `.redis_pass_file` file, or use the sample:
7+
```
8+
cp .docker-compose/.redis_pass_file.local .docker-compose/.redis_pass_file
9+
```
10+
11+
### Clients
12+
13+
Clients on the same machine, can join this service by define an external network,
14+
for example when the client network name is `sample-network` it should define as:
15+
16+
```
17+
networks:
18+
sample-network:
19+
external:
20+
name: redis_redis-network
21+
```
22+
23+
The `external` network name, has two part, which are separated by an underline, `redis` is name of the repository, and `redis-network` is the network name of this repository

docker-compose.yml

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
version: '3'
2+
3+
services:
4+
redis:
5+
image: 'redis:5-alpine'
6+
environment:
7+
# the path of password in container
8+
REDIS_PASS_FILE: /run/secrets/redis-password
9+
command: [
10+
"sh", "-c",
11+
'
12+
docker-entrypoint.sh
13+
--requirepass "$$(cat $$REDIS_PASS_FILE)"
14+
'
15+
]
16+
expose:
17+
- "6379"
18+
volumes:
19+
- redis-volume:/data
20+
# pass host password to container
21+
- ./.docker-compose/.redis_pass_file:/run/secrets/redis-password
22+
networks:
23+
- redis-network
24+
25+
26+
volumes:
27+
redis-volume:
28+
29+
networks:
30+
redis-network:
31+
driver: bridge

0 commit comments

Comments
 (0)