I. Main points of this paper

This paper will introduce how to use Docker to quickly build a development environment and build Redis instances. A complete catalog of articles in the series

  • Docker command
  • Docker installed redis
  • Common docker commands
  • Docker copies files to the host
  • Docker file copy error

Second, development environment

  • 2 d0083d docker 18.09.7, build
  • Linux 64 – bit
  • Redis 4.0

Install docker

Reference: blog.csdn.net/caiwen_5050…

4. Install Redis

1. Install and set the password

Create directories and files
mkdir -p /data/redis/conf
touch /data/redis/conf/redis.conf
# redis
docker search redis
#docker pull redis:latestdocker run -p 6379:6379 --name redis4 -v /data/redis/conf/redis.conf:/etc/redis/redis.conf -v /data/redis:/data -d Redis :4.0 redis-server --appendonly yes --requirepass"9uWNx7uJJtA/wkQWt7JXcURyVpWfiZ/a"

Copy the code

2. Copy the container’s redis-cli file to the host

Enter the redis container
docker exec -it redis4 /bin/bash

# View redis-cli file location
root@d7e88263ee43:/bin# which redis-cli
/usr/local/bin/redis-cli

Exit the container and run the command on the host to copy the file to the current directory
exit
docker cp redis4:/usr/local/redis-cli -h xxx.xxx.xxx. XXX -a'xxxxx'


If the following error is reported, please update the docker
# Error response from daemon: error processing tar file: docker-tar: relocation error: /lib/x86_64-linux-gnu/libnss_files.so.2: symbol __libc_readline_unlocked, version GLIBC_PRIVATE not defined in file libc.so.6 with link time reference
#: exit status 127
# For people who is lead to this page after searching with the error message, please upgrade the version of Docker >= 19.03.8.


Copy the code

Five, the summary

A few simple commands, set up Redis, is not very simple. Springboot integration with Redis and Clustering

Add me to exchange learning!