How to install redis5.0.3 in docker

How to install redis5.0.3 in docker

1. Pull the official 5.0.3 image

[root@localhost ~]# docker pull redis:5.0.3

Download Complete

[root@localhost ~]# docker pull redis:5.0.3
5.0.3: Pulling from library/redis
f7e2b70d04ae: Pull complete 
421427137c28: Pull complete 
4af7ef63ef0f: Pull complete 
b858087b3517: Pull completed 
2aaf1944f5eb: Pull complete 
8270b5c7b90d: Pull complete 
Digest: sha256:4be7fdb131e76a6c6231e820c60b8b12938cf1ff3d437da4871b9b2440f4e385
Status: Downloaded newer image for redis:5.0.3

2. Create a mount directory

1. Create a mount folder

[root@localhost ~]# mkdir -p /root/redis/data /root/redis/conf
[root@localhost ~]# cd redis/
[root@localhost redis]# ls
conf data

2. Create redis.conf

Create the file redis.conf in the /root/redis/conf directory

touch redis.conf

Show Catalog

[root@localhost redis]# cd conf/
[root@localhost conf]# ls
[root@localhost conf]# touch redis.conf
[root@localhost conf]# ls
redis.conf
[root@localhost conf]#

3. Create a redis container

docker run -d --name redis -p 6379:6379 -v /root/redis/conf/redis.conf:/redis.conf -v /root/redis/data:/data redis:5.0.3 redis-server --appendonly yes

Parameter Description:

-d Run in the background

-p port mapping to the host port

-v mounts the host directory to the container's directory

redis-server --appendonly yes : Execute the redis-server startup command in the container and turn on the redis persistence configuration

1. Start redis

The error reported during startup is as follows:

[root@localhost ~]# docker run -d --name redis -p 6379:6379 -v /root/redis/conf/redis.conf:/redis.conf -v /root/redis/data:/data redis:5.0.3 redis-server --appendonly yes
9bc537c19ff0ad76727b5215da8cba4223c5ff97f1d9a53585d573ca71fd8c0c
docker: Error response from daemon: driver failed programming external connectivity on endpoint redis (fa297144f8d0c958288bb35a94ffbec545d348f2ff9f55a5b573f3d9a0354ace): (iptables failed: iptables --wait -t nat -A DOCKER -p tcp -d 0/0 --dport 6379 -j DNAT --to-destination 172.17.0.3:6379 ! -i docker0: iptables: No chain/target/match by that name.
 (exit status 1)).

Note: The custom chain DOCKER defined when the docker service is started is cleared for some reason. Restart the docker service and regenerate the custom chain DOCKER

Solution:

Step 1. Restart Docker.

Step 2: Start the container;

systemctl restart docker
docker start foo

2. The container is created successfully and the redis container is started

docker start redis

1. Startup failure problem: When starting the container, an error message appears: iptables: No chain/target/match by that name

The rough solution is to restart Docker

2. Normal startup and display

4. Client connection

I use RedisDesktopManager


The above is the full content of this article. I hope it will be helpful for everyone’s study. I also hope that everyone will support 123WORDPRESS.COM.

You may also be interested in:
  • Detailed explanation of installing redis in docker and starting it as a configuration file
  • Docker installs Redis and introduces the visual client for operation
  • Docker installs redis 5.0.7 and mounts external configuration and data issues
  • How to deploy redis in linux environment and install it in docker
  • Docker installs the official Redis image and enables password authentication
  • 5 minutes to teach you how to install and start redis in docker (new method)

<<:  Full steps to create a password generator using Node.js

>>:  Various problems encountered by novices when installing mysql into docker

Recommend

Mysql sets boolean type operations

Mysql sets boolean type 1. Tinyint type We create...

How to implement MySQL master-slave replication based on Docker

Preface MySQL master-slave replication is the bas...

Solution to the 404/503 problem when logging in to TeamCenter12

TeamCenter12 enters the account password and clic...

The three new indexes added in MySQL 8 are hidden, descending, and functions

Table of contents Hidden, descending, and functio...

LINUX Checks whether the port is occupied

I have never been able to figure out whether the ...

mysql workbench installation and configuration tutorial under centOS

This article shares the MySQL Workbench installat...

Understanding Vuex in one article

Table of contents Overview Vuex four major object...

Detailed explanation of Mysql communication protocol

1.Mysql connection method To understand the MySQL...

Life cycle and hook functions in Vue

Table of contents 1. What is the life cycle 2. Th...

Example of adding and deleting range partitions in MySQL 5.5

introduce RANGE partitioning is based on a given ...