Docker install Redis
Redis is an open-source, network-supported, log-type, in-memory yet persistable Key-Value NoSQL database written in ANSI C, and provides APIs in many languages.
1. Check available Redis versions
Visit the Redis image repository address: https://hub.docker.com/_/redis?tab=tags。
You can use Sort by to view other versions of Redis; the default is the latest version redis:latest。
You can also find other versions you want in the drop-down list:
In addition, we can use the docker search redis command to view available versions:
$ docker search redis
NAME DESCRIPTION STARS OFFICIAL AUTOMATED
redis Redis is an open source ... 2321 [OK]
sameersbn/redis 32 [OK]
torusware/speedus-redis Always updated official ... 29 [OK]
bitnami/redis Bitnami Redis Docker Image 22 [OK]
anapsix/redis 11MB Redis server image ... 6 [OK]
webhippie/redis Docker images for redis 4 [OK]
clue/redis-benchmark A minimal docker image t... 3 [OK]
williamyeh/redis Redis image for Docker 3 [OK]
unblibraries/redis Leverages phusion/baseim... 2 [OK]
greytip/redis redis 3.0.3 1 [OK]
servivum/redis Redis Docker Image 1 [OK]
...
2. Get the latest Redis image
Here we pull the official latest-version image:
$ docker pull redis:latest
3. View local images
Use the following command to check whether redis is installed:
$ docker images
In the figure above we can see that we have installed the redis image of the latest version (latest).
4. Run the container
After installation, we can use the following command to run the redis container:
$ docker run -itd --name redis-test -p 6379:6379 redis
Parameter Description:
- -p 6379:6379: Map the container service's port 6379 to the host's port 6379. External hosts can directly access the Redis service via host-ip:6379.
5. Installation successful
Finally, we can use the docker ps command to check the container's running information:
Next, we use redis-cli to connect and test the redis service.
$ docker exec -it redis-test /bin/bash






