Atlantic.Net Blog

How to Deploy and Run Redis in Docker

Hitesh Jethva
by Atlantic.Net (273 posts) under Dedicated Server Hosting, Tutorials

Redis is an open-source, fast, and in-memory key-value data store. It can be used as a database, cache, message broker, and queue. Redis is designed for distributed cluster environment and it can handle large datasets. Deploying Redis in a Docker container will help to scale Redis and fit it right into your development environment.

In this post, we will show you how to deploy Redis with Docker on Ubuntu 20.04.


  • A fresh Ubuntu 20.04 server on the Atlantic.Net Cloud Platform
  • A root password configured on your server

Step 1 – Create Atlantic.Net Cloud Server

First, log in to your Atlantic.Net Cloud Server. Create a new server, choosing Ubuntu 20.04 as the operating system with at least 4GB RAM. Connect to your Cloud Server via SSH and log in using the credentials highlighted at the top of the page.

Once you are logged in to your Ubuntu 20.04 server, run the following command to update your base system with the latest available packages.

apt-get update -y

Step 2 – Install Docker

By default, the latest version of Docker is not included in the Ubuntu default repository, so you will need to add the Docker official repository to your system.

First, install all required dependencies using the following command:

apt-get install apt-transport-https ca-certificates curl gnupg-agent software-properties-common -y

Next, add the Docker repository with the following command:

curl -fsSL | apt-key add -
add-apt-repository "deb [arch=amd64] $(lsb_release -cs) stable"

Once the repository is added, install Docker with the following command:

apt-get install docker-ce -y

Once Docker is installed, check the status of Docker with the following command:

systemctl status docker


● docker.service - Docker Application Container Engine
     Loaded: loaded (/lib/systemd/system/docker.service; enabled; vendor preset: enabled)
     Active: active (running) since Mon 2021-06-07 07:14:36 UTC; 13s ago
TriggeredBy: ● docker.socket
   Main PID: 9081 (dockerd)
      Tasks: 10
     Memory: 41.0M
     CGroup: /system.slice/docker.service
             └─9081 /usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sock

Step 3 – Download Redis Image

Next, you will need to download the latest version of the Redis image from the Docker registry. You can download it with the following command:

docker pull redis:latest


latest: Pulling from library/redis
69692152171a: Pull complete 
a4a46f2fd7e0: Pull complete 
bcdf6fddc3bd: Pull complete 
2902e41faefa: Pull complete 
df3e1d63cdb1: Pull complete 
fa57f005a60d: Pull complete 
Digest: sha256:7e2c6181ad5c425443b56c7c73a9cd6df24a122345847d1ea9bb86a5afc76325
Status: Downloaded newer image for redis:latest

You can now verify the downloaded image with the following command:

docker images


redis        latest    fad0ee7e917a   5 days ago   105MB

Step 4 – Launch Redis Container

Next, you will need to launch a Redis container from the downloaded image. You can launch it with the following command:

docker run --name redis-instance -dit redis



Once the container is started, you can check it with the following command:

docker ps

You should see the following output:

CONTAINER ID   IMAGE     COMMAND                  CREATED          STATUS         PORTS      NAMES
2e7b27647159   redis     "docker-entrypoint.s…"   11 seconds ago   Up 9 seconds   6379/tcp   redis-instance

As you can see, the Redis container is started and listening on port 6379.

Step 5 – Connect the Redis Container

Next, you can connect to the Redis container with the following command:

docker exec -it redis-instance /bin/bash

Once you are connected, you should see the following shell:

[email protected]:/data#

Now, connect to the Redis interface with the following command:

[email protected]:/data# redis-cli


Now, test the Redis with the ping command:> ping

If everything is fine, you should see the following output:


Run the quit command to exit from the Redis CLI.> quit

Next, exit from the Redis container with the following command:

[email protected]:/data# exit


Congratulations! You have successfully deployed a Redis within a Docker container. You can now use this setup to deploy and scale a Redis within a Docker cluster on your dedicated hosting account from Atlantic.Net.

Get A Free To Use Cloud VPS

Free Tier Includes:
G3.2GB Cloud VPS Free to Use for One Year
50 GB of Block Storage Free to Use for One Year
50 GB of Snapshots Free to Use for One Year

Looking for a Hosting Solution?

We Provide Cloud, Dedicated, & Colocation.

  • Seven Global Data Center Locations.
  • Flexible Private, Public, & Hybrid Hosting.
  • 24x7x365 Security, Support, & Monitoring.
Contact Us Now! Med Tech Award FTC
SOC Audit HIPAA Audit HITECH Audit

Recent Posts

Get started with 12 months of free cloud VPS hosting

Free Tier includes:
G3.2GB Cloud VPS Server Free to Use for One Year
50 GB of Block Storage Free to Use for One Year
50 GB of Snapshots Free to Use for One Year

New York, NY

100 Delawanna Ave, Suite 1

Clifton, NJ 07014

United States

San Francisco, CA

2820 Northwestern Pkwy,

Santa Clara, CA 95051

United States

Dallas, TX

2323 Bryan Street,

Dallas, Texas 75201

United States

Ashburn, VA

1807 Michael Faraday Ct,

Reston, VA 20190

United States

Orlando, FL

440 W Kennedy Blvd, Suite 3

Orlando, FL 32810

United States

Toronto, Canada

20 Pullman Ct, Scarborough,

Ontario M1X 1E4


London, UK

14 Liverpool Road, Slough,

Berkshire SL1 4QZ

United Kingdom