docker_practice/appendix/repo/redis.md

43 lines
1.1 KiB
Go
Raw Blame History

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

# [Redis](https://hub.docker.com/_/redis/)
##
[Redis](https://en.wikipedia.org/wiki/Redis) 是开源的内存 Key-Value 数据库实现。
`https://hub.docker.com/_/redis/` Redis 3.x ~ 6.x
## 使
`6379`
```bash
$ docker run --name some-redis -d -p 6379:6379 redis
```
[](https://redis.io/topics/persistence)。
```bash
$ docker run --name some-redis -d -p 6379:6379 redis redis-server --appendonly yes
```
`VOLUME/data`使 `--volumes-from some-volume-container` `-v /docker/host/dir:/data`
使
```bash
$ docker run --name some-app --link some-redis:redis -d application-that-uses-redis
```
`redis-cli`
```bash
$ docker run -it --rm \
--link some-redis:redis \
redis \
sh -c 'exec redis-cli -h "$REDIS_PORT_6379_TCP_ADDR" -p "$REDIS_PORT_6379_TCP_PORT"'
```
## Dockerfile
https://github.com/docker-library/docs/tree/master/redis 查看。