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

How to use docker to build redis master-slave

1. Build a Docker environment 1. Create a Dockerf...

Common attacks on web front-ends and ways to prevent them

The security issues encountered in website front-...

Vue event's $event parameter = event value case

template <el-table :data="dataList"&...

Solution to Vue data assignment problem

Let me summarize a problem that I have encountere...

How to add fields and comments to a table in sql

1. Add fields: alter table table name ADD field n...

Radio buttons and multiple-choice buttons are styled using images

I've seen people asking before, how to add sty...

CentOS IP connection network implementation process diagram

1. Log in to the system and enter the directory: ...

Solution to ERROR 1366 when entering Chinese in MySQL

The following error occurs when entering Chinese ...

Detailed explanation of zabbix executing scripts or instructions on remote hosts

Scenario Requirements 1. We can use the script fu...

How to deploy MySQL and Redis services using Docker

Table of contents How to deploy MySQL service usi...

HTML table_Powernode Java Academy

To draw a table in HTML, use the table tag tr me...

React's transition from Class to Hooks

Table of contents ReactHooks Preface WhyHooks? Fo...

Sharing tips on using vue element and nuxt

1. Element time selection submission format conve...

Example of javascript bubble sort

Table of contents 1. What is Bubble Sort 2. Give ...

Introduction to Common XHTML Tags

<br />For some time, I found that many peopl...