3 Simple Steps to Run Redis Docker in CentOS or Linux Machine by@beetechnical

3 Simple Steps to Run Redis Docker in CentOS or Linux Machine

image
Beetechnical HackerNoon profile picture

Beetechnical

Beetechnical is a free and open platform for software professionals. who enjoys reading, writing, passing on knowledge.

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.

We need a few Prerequisites to setup the Redis Docker Image

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

Install Docker Container as One-time Activity

The following link will help you to set up the docker in your machine.

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, let’s start by accessing the VM using the ssh client.

image

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

Search Redis Docker 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/

image

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

image

As you can see on the detailed page. the command is already listed which can be used to install the Redis server.

Pull Redis Docker Image By Issuing the Command

docker run --name myredis -d redis

image

Once you are done with the installation. Issue docker ps command to see the running instance of Redis.

docker ps -a

image

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.

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

image

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/

Beetechnical HackerNoon profile picture
by Beetechnical @beetechnical.Beetechnical is a free and open platform for software professionals. who enjoys reading, writing, passing on knowledge.
Read my stories

Comments

Signup or Login to Join the Discussion

Tags

Related Stories