Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to install redis for docker

2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/01 Report--

This article is about how docker installs redis. The editor thinks it is very practical, so share it with you as a reference and follow the editor to have a look.

Docker installs redis1. Download Image download Image sudo docker pull redis

Ubuntu@VM-0-13 Murubuntuvus sudo docker pull redis

Using default tag: latest

Latest: Pulling from library/redis

C499e6d256d6: Already exists

Bf1bc8a5a7e4: Pull complete

7564fb795604: Pull complete

Ec6e86f783e4: Pull complete

1371d6223f46: Pull complete

021fd554320f: Pull complete

Digest: sha256:a732b1359e338a539c25346a50bf0a501120c41dc248d868e546b33e32bf4fe4

Status: Downloaded newer image for redis:latest

Docker.io/library/redis:latest

View the downloaded image sudo docker images

Mark2. Start redis to create the redis.conf configuration file sudo mkdir-p / mydata/redis/conf

Sudo touch / mydata/redis/conf/redis.conf

Launch redissudo docker run-p 6379mydata/redis/data:/data 6379-- name redis-v / mydata/redis/data:/data\

-v / mydata/redis/conf/redis.conf:/etc/redis/redis.conf\

-d redis redis-server / etc/redis/redis.conf

Mark3. Connect redissudo docker exec-it redis redis-cli

4. Test redis

Set astat100 and return OK

Set a 100

Gets the value of an and returns "100"

Get a

Mark5. Set up redis persistent storage to modify the redis profile for virtual machine mapping:

Sudo vim / mydata/redis/conf/redis.conf

Add configuration:

Appendonly yes

Check whether it is effective to restart the redis container:

Docker restart redis

Set astat200 and return OK

Set a 200

Gets the value of an and returns "200"

Get a

Restart the redis container

Sudo docker restart redis

Reconnect the redis container

Sudo docker exec-it redis redis-cli

Get the value of a

Get a, return "200"

6. Install redis Visualizer

Install redis Visualizer

Redis-desktop-manager

Connect redis

Mark check the redis database mark. Thank you for reading! This is the end of this article on "how to install redis in docker". I hope the above content can be of some help to you, so that you can learn more knowledge. if you think the article is good, you can share it out for more people to see!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report