docker_practice/appendix/repo/redis.md

43 lines
1.1 KiB
Go
Raw Normal View History

# [Redis](https://hub.docker.com/_/redis/)
2016-12-10 17:00:25 +08:00
##
2017-11-24 10:19:15 +08:00
2016-12-10 17:00:25 +08:00
[Redis](https://en.wikipedia.org/wiki/Redis) 是开源的内存 Key-Value 数据库实现。
`https://hub.docker.com/_/redis/` Redis 3.x ~ 6.x
2016-12-10 17:00:25 +08:00
## 使
2017-11-24 10:19:15 +08:00
2016-12-10 17:00:25 +08:00
`6379`
2017-11-22 11:13:23 +08:00
```bash
2019-04-15 11:11:58 +08:00
$ docker run --name some-redis -d -p 6379:6379 redis
2016-12-10 17:00:25 +08:00
```
2017-11-24 10:19:15 +08:00
2019-01-06 10:15:13 +08:00
[](https://redis.io/topics/persistence)。
2016-12-10 17:00:25 +08:00
2017-11-22 11:13:23 +08:00
```bash
2019-04-15 11:11:58 +08:00
$ docker run --name some-redis -d -p 6379:6379 redis redis-server --appendonly yes
2016-12-10 17:00:25 +08:00
```
`VOLUME/data`使 `--volumes-from some-volume-container` `-v /docker/host/dir:/data`
使
2017-11-22 11:13:23 +08:00
```bash
2016-12-10 17:00:25 +08:00
$ docker run --name some-app --link some-redis:redis -d application-that-uses-redis
```
2017-11-24 10:19:15 +08:00
2016-12-10 17:00:25 +08:00
`redis-cli`
2017-11-22 11:13:23 +08:00
```bash
2017-12-01 17:32:39 +08:00
$ 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"'
2016-12-10 17:00:25 +08:00
```
## Dockerfile
2017-11-01 00:36:57 +08:00
https://github.com/docker-library/docs/tree/master/redis 查看。