Let’s discuss the easiest way of setting up the Redis Docker server using the Docker container.
If you are planning to install the Redis service, this gives me an indication that you are already aware of it and what are the use cases of it.
I am not sure about you guys, but I am a really big fan of Docker. It makes things faster and easier. We are going to install the Redis server image using the docker container. It’s much simpler and easier than installing it in Windows or Linux.
The following link will help you to set up the docker in your machine.
https://docs.docker.com/engine/install
I have a docker container up and running in my CentOs 7 virtual machine. So, let’s start by accessing the VM using the ssh client.
Once connected to the Linux machine. I have already installed the docker engine on my machine.
If you are not sure about the Redis server image, not a problem. Just open the Docker hub and search for the image which you want to install.
You should also see a similar search result. Just click on the first result is. It will redirect you to the detailed page of Redis
As you can see on the detailed page. the command is already listed which can be used to install the Redis server.
docker run --name myredis -d redis
Once you are done with the installation. Issue docker ps command to see the running instance of Redis.
docker ps -a
As we can see our Redis container image is up and running. so, lets try to connect to the Redis server our Redis-CLI tool.
As we have seen earlier installation guides, Redis-CLI can be run directly to the machine where the Redis server is running. But, in this case, it’s a bit different.
sudo docker exec -it myredis redis-cli ping
if the executed command is successful then you would see the response message “PONG” from the Redis server.
That’s it! You are done with the installation of the Redis server on the docker container. You can start consuming the Redis server using varieties of languages like C#, Python, and Node Js.
Also published here: https://beetechnical.com/tech-tutorial/how-to-install-redis-using-docker/