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
1. Update the entire table. If the value of a col...
If you use CSS don't forget to write DOCTYPE, ...
Innodb includes the following components 1. innod...
Problem Description A Spring + Angular project wi...
1. Basic Environment 1. Operating system: CentOS ...
Remax is an open source framework developed by An...
1. Environment and preparation 1. Ubuntu 14.04 2....
Database performance optimization generally adopt...
Benefits of a programmatic approach 1. Global con...
The following two functions are used in the same ...
Table of contents Overview Environment Preparatio...
Preface As we all know, "How to vertically c...
Table of contents 1. Create a stored function 2. ...
In the previous article, I introduced how to solv...
Sometimes we want to execute a command in a conta...