How to Run Redis Server as Docker Container


So, In the last post, we have seen. How to install the Redis server on Linux machine . Let’s discuss the easiest way of installing the Redis server using the Docker container.

I am not sure about you guys, but i am a really big fan of Dockers. It makes things faster and easier.

Eg. We are going to install the Redis server image using docker container. Its much more simpler and easier then installing in windows or Linux.

Prerequisites

Registered Account with Docker Hub.
Docker Engine running on any of the OS(Linux, Windows, Mac).
Credentials already configured with Docker Engine to download the image from Docker hub.

Install Docker Container

In case you want to install the Docker container refer this link.

https://docs.docker.com/engine/install

Connect to Host Machine

I have a docker container up and running in my CentOs 7 virtual machine. So, lets start by accessing the VM using the ssh client.

Once connected to the Linux machine. I have already installed the docker engine in my machine.

Find Redis Image in Docker Hub

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.

https://hub.docker.com/

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 in the detailed page. the command is already listed which can be used to install the Redis server.

Pull Redis Image

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 Redis server our Redis-CLI tool.

Redis-Cli tool in Docker

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 response message “ PONG ” from Redis server.

That’s it! You are done with the installation of the Redis server on the docker container.
The post How to Run Redis Server as Docker Container appeared first on Beetechnical .

Top