1. Introduction This article will show you how to explore Redis using Docker. We can run Docker commands in Docker for Windows, Docker for mac, or Linux mode. This article is based on Docker for mac. 2. View available Redis versions You can view the Redis image in the image repository: 3. Get the image Use the following command to pull the latest official version of the image: docker pull redis:latest 4. View local image Use the following command to check whether the Redis image has been installed: docker images In the picture we can see that we have installed the latest version of the Redis image. 5. Run the container We give the container a name docker-redis, expose port 6379 (the default value for Redis), and run the container using the following command: docker run -d -p 6379:6379 --name docker-redis redis -p 6379:6379: maps the 6379 port of the container service to the 6379 port of the host machine. The outside world can directly access the Redis service through the host ip:6379. You can use the following command to view the running information of the container to determine whether the container is running successfully: docker ps You can also view the log output by running the following command: docker logs docker-redis 6. Run Redis CLI in the container Next, we connect to the redis service by running redis-cli in the container. We will start a new interactive session with the -it option in the running container and use it to run redis-cli: docker exec -it docker-redis /bin/bash Now that we are connected to the container, let's run redis-cli: root@517350f4f2bb:/data# redis-cli Now we can run some basic Redis commands: 7. Clean up the container Let's stop the docker-redis container and remove it: docker stop docker-redis docker rm docker-redis Summarize This is the end of this article about using Redis in Docker. For more information about using 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:
|
<<: MySQL performance optimization: how to use indexes efficiently and correctly
>>: Specific usage of fullpage.js full screen scrolling
Recently, I encountered a database with the follo...
This article uses an example to describe the inte...
1. Idea It only took 6 seconds to insert 1,000,00...
Preface What is the role of an agent? - Multiple ...
Preface Use nginx for load balancing. As the fron...
Mysql query time period intersection Usage scenar...
First, download the installation package from the...
Table of contents 1. Dep 2. Understand obverser 3...
Copy code The code is as follows: jQuery.cookie =...
This article shares the manual installation tutor...
Today, I set up a newly purchased Alibaba Cloud E...
This article is mainly to take you to quickly und...
This article shares the specific code of Vue3 man...
When newbies develop div+css, they need to name t...
Result: Implementation Code html <div id="...