1 Find the redis image on Docker Hub
[root@wugenqiang redis]# docker search redis
2 pull the image
[root@wugenqiang ~]# docker pull redis:3.2
Here we pull the official image, labeled 3.2
3 Run the image
[root@wugenqiang redis]# docker run -d --name redis-server -p 6379:6379 -v $PWD/data:/data -d redis:3.2 --requirepass "123456" --appendonly yes
Command description:
-p 6379:6379: Map the 6379 port of the container to the 6379 port of the host
-v $PWD /data:/data: Mount the data in the current directory in the host to the container’s /data
My $PWD/data =
- -appendonly yes: Execute the startup command in the container and open the redis persistence configuration
4 Check the container startup status
[root@wugenqiang redis]# docker ps
The above is the detailed content of How to quickly deploy Redis with Docker. For more information, please follow other related articles on the PHP Chinese website!