Three, docker mount installation and configuration redis

First, make sure that the right environment, docker state has been running, the firewall is turned off (or ip and port accessible)
Second, download the image
1, image search

docker search redis

Here Insert Picture Description

Since we are using the redis-3.2.11

So, go
https://hub.docker.com
version looking at

Here Insert Picture Description

Here Insert Picture Description
You can see, there is this version 3.2.11

2, Download image

docker pull redis:3.2.11

- View Mirror

docker images

Here Insert Picture Description

3, start the container and configured to mount the directory
- Create Folder

mkdir -p /data/redis/data /data/redis/conf

Here Insert Picture Description
-Conf placed redis.conf configuration file in the directory
3.1 conf file to download
Download redis.conf
redis.conf address

Here Insert Picture Description

Enter the conf directory

cd conf/

Download the conf file
wget https://raw.githubusercontent.com/antirez/redis/3.0/redis.conf

Here Insert Picture Description
If wget is not found, install wget components, and then download
Here Insert Picture Description

Using a configuration file to start a container:

docker run -p 6379:6379 -v /data/redis/conf/redis.conf:/etc/redis/redis.conf -v /data/redis/data:/data --privileged=true --name redis-pro -d redis:3.2.11 --appendonly yes

- A way to start the configuration file (case)

docker run -p 6379:6379 -v /data/redis/conf/redis.conf:/etc/redis/redis.conf -v /data/redis/data:/data --privileged=true --name redis-pro -d redis:3.2.11 redis-server /etc/redis/redis.conf  --appendonly yes

Parameter analysis:
-restart = Always -> boot container, container abnormal automatic restart
-d -> way to start the daemon container
-privileged = true -> elevate the container rights
-p 6379: 6379 -> bind host port
-v /data/redis/conf/redis.conf:/etc/redis/redis.conf -> mapping configuration file
-v / data / redis / data: / data -> map data directory
-name redis-pro -> specify The container name
-appendonly yes -> open data persistence

View container running

docker ps

Here Insert Picture Description

Connection Test

Here Insert Picture Description

Published 14 original articles · won praise 2 · Views 169

Guess you like

Origin blog.csdn.net/weixin_41402056/article/details/105149036