Record: Running a Redis instance in Docker
When we install Docker in the Windows system, a Linux virtual machine is automatically created in Hyper-V, and if this VM is not running, it means that Windows Container is currently running, and we can switch to Linux Container, on the small whale icon right-→switch to Linux Containers, this time the virtual machine in Hyper-V will start.
Pull the official Redis image from the Docker hub first
Docker Pull Redis
After the pull is complete, view all current mirrors
Docker images
Create a Reids container because I have already installed the Redis port is 6379, so the Redis in the container maps to my machine when I choose 6380
Docker Run-p 6380:6379-d Redis
Start a Redis interactive container to connect to a Redis instance
Docker run-it Redis redis-cli-h 172.17.0.2
The IP address can be viewed through the inspect command, and we'll set up the Redis instance's Requirepass
We can run multiple containers, as long as the port mapped to the local does not conflict.
Redis in Docker on Linux Container