How to install redis in Docke

How to install redis in Docke

1. Search for redis image

docker search redis

2. Download the redis image

docker pull redis:latest

3. Start the redis container

--name The name of the container after startup
--restart=always restart automatically
-p port mapping
-v directory mount
--requirepass login password

docker run -itd --name redis --restart=always -p 6379:6379 -v /data/docker/redis/config:/etc/redis -v /data/docker/redis/data:/data redis redis-server /etc/redis/redis.conf --requirepass "123456" --appendonly yes

Knowledge point expansion:

Install redis using docker

1. Install Docker

1. Check the kernel version, which must be 3.10 or above [root@localhost ~]# uname -r 
2. Install Docker 
   [root@localhost ~]# yum install docker 
4. Start Docker
  [root@localhost ~]# systemctl start docker 
  Check the version [root@localhost ~]# docker -v  
  Docker version 1.12.6, build 3e8e77d/1.12.6
5. Start Docker on boot 
 [root@localhost ~]# systemctl enable docker 
6. Stop Docker 
 [root@localhost ~]# systemctl stop docker

2. Install redis

Visit: https://hub.docker.com/

Searching for redis we can see

Download: docker pull redis command (slower)

Recommended: Visit Docker China https://www.docker-cn.com/

Click Mirror Acceleration: You can see the following example:

$ docker pull registry.docker-cn.com/library/ubuntu:16.04

Download redis

//Use mirroring to speed up downloading redis
docker pull registry.docker-cn.com/library/redis

After downloading, view the image: docker images

[root@VM_0_4_centos ~]# docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
registry.docker-cn.com/library/redis latest 4e8db158f18d 2 weeks ago 83.4 MB

Start redis

docker run -d -p 6379:6379 --name myredis registry.docker-cn.com/library/redis

View redis

[root@VM_0_4_centos ~]# docker ps
 
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
7512230290be registry.docker-cn.com/library/redis "docker-entrypoint..." 22 hours ago Up 22 hours <br>0.0.0.0:6379->6379/tcp myredis

This is the end of this article about how to install redis in Docker. For more information about how to install redis in Docker, please search for previous articles on 123WORDPRESS.COM or continue to browse the following related articles. I hope you will support 123WORDPRESS.COM in the future!

You may also be interested in:
  • Detailed explanation of installing redis in docker and starting it as a configuration file
  • How to install redis in docker and set password and connect
  • How to install redis5.0.3 in docker
  • 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
  • How to install common components (mysql, redis) in Docker

<<:  JavaScript implementation of the back to top button example

>>:  How to implement vertical text alignment with CSS (Summary)

Recommend

HTML realizes real-time monitoring function of Hikvision camera

Recently the company has arranged to do some CCFA...

Example of how to enable Slow query in MySQL

Preface Slow query log is a very important functi...

What does href=# mean in a link?

Links to the current page. ------------------- Com...

Tips on MySQL query cache

Table of contents Preface Introduction to QueryCa...

How to create, save, and load Docker images

There are three ways to create an image: creating...

CSS3 text animation effects

Effect html <div class="sp-container"...

MySQL slow query: Enable slow query

1. What is the use of slow query? It can record a...

Example of converting webpack images to base64

Download url-loader yarn add -D url-loader module...

Solution to the problem of null column in NOT IN filling pit in MySQL

Some time ago, when I was working on a small func...

How to change the website accessed by http to https in nginx

Table of contents 1. Background 2. Prerequisites ...

About the problem of writing plugins for mounting DOM in vue3

Compared with vue2, vue3 has an additional concep...

Detailed Example of MySQL curdate() Function

MySQL CURDATE Function Introduction If used in a ...

HTML page adaptive width table

In the pages of WEB applications, tables are ofte...

Implementation of TypeScript in React project

Table of contents 1. Introduction 2. Usage Statel...

Detailed explanation of gcc command usage under Linux system

Table of contents 1. Preprocessing 2. Compilation...