Coding With Fun
Home Docker Django Node.js Articles Python pip guide FAQ Policy

Docker Common Warehouse Redis


May 22, 2021 Docker From entry to practice


Table of contents


Redis

Basic information

Redis is an open source memory Key-Value database implementation. The repository provides a mirror image of each version of Redis 2.6 to 2.8.9.

How to use it

The database 6379 by default.

$ sudo docker run --name some-redis -d redis

Persistent storage can also be enabled.

$ sudo docker run --name some-redis -d redis redis-server --appendonly yes

The default data storage location is VOLUME/data Data --volumes-from some-volume-container -v /docker/host/dir:/data

Connect to the container using a different app, which you can use

$ sudo docker run --name some-app --link some-redis:redis -d application-that-uses-redis

Or through redis-cli

$ sudo docker run -it --link some-redis:redis --rm redis sh -c 'exec redis-cli -h "$REDIS_PORT_6379_TCP_ADDR" -p "$REDIS_PORT_6379_TCP_PORT"'

Dockerfile