docker install redis configuration file

Create a new host directory: 
1. Create a docker unified external configuration file 

mkdir -p docker / redis / {conf, data} 

2. Create a configuration file for 

redis.conf in the conf directory touch /docker/redis/conf/redis.conf 

3 . The content of the redis.conf file needs to be downloaded by itself. Remember to modify it with the previous configuration: there is a pit in the above process, that is, the configuration of "daemonize no". If the parameter value is yes when the container is started, it is Unable to start mirroring. 

4. Create a startup container, load configuration files and persist data 

 docker container run --restart = always \ 
-p 6379: 6379 \ 
-v / docker / redis / data: / data \ 
-v / docker / redis / conf / redis .conf: 
/etc/redis/redis.conf \ --privileged = true \ 
--name myredis \ 
-d redis redis-server 
/etc/redis/redis.conf --appendonly yes 


# redis-cli access docker run -it --link myredis: redis --rm redis redis-cli -h redis -p 6379 
# -it interactive virtual terminal 
# --rm exit is to delete this container

docker internal access 
docker container exec -it myredis / bin / bash 
redis-cli

  

Guess you like

Origin www.cnblogs.com/hoge66/p/12706851.html