Skip to main content

How to Deploy and Run Redis in a Docker container


Profile picture for Ajeet Raina
Author:
Ajeet Raina, Former Developer Growth Manager at Redis

Pre-requisites

Ensure that Docker is installed in your system.

If you're new, refer to Docker's installation guide to install Docker on Mac.

To pull and start the Redis Enterprise Software Docker container, run this docker run command in the terminal or command-line for your operating system.

note

On Windows, make sure Docker is configured to run Linux-based containers.

docker run -d --cap-add sys_resource --name rp -p 8443:8443 -p 9443:9443 -p 12000:12000 redislabs/redis

In the web browser on the host machine, go to https://localhost:8443 to see the Redis Enterprise Software web console.

Step 1: Click on “Setup”

Click Setup to start the node configuration steps.

Setting up nodes

Step 2: Enter your preferred FQDN

In the Node Configuration settings, enter a cluster FQDN such as demo.redis.com. Then click the Next button.

Redis Enterprise Setup

Enter your license key, if you have one. If not, click the Next button to use the trial version.

Step 3: Enter the admin credentials

Enter an email and password for the admin account for the web console.

Login credentials

These credentials are also used for connections to the REST API. Click OK to confirm that you are aware of the replacement of the HTTPS SSL/TLS certificate on the node, and proceed through the browser warning.

Step 4: Create a Database:

Select “Redis database” and the “single region” deployment, and click Next.

Creating a database

Enter a database name such as demodb and click Activate to create your database

Creating a database

You now have a Redis database!

Step 5: Connecting using redis-cli

After you create the Redis database, you are ready to store data in your database. redis-cli is a built-in simple command-line tool to interact with Redis databases. Run redis-cli, located in the /opt/redislabs/bin directory, to connect to port 12000 and store and retrieve the value of a key in the database:

$ docker exec -it rp bash
redislabs@fd8dca50f905:/opt$
/opt/redislabs/bin/redis-cli -p 12000
127.0.0.1:12000> auth <enter password>
OK
127.0.0.1:12000> set key1 123
OK
127.0.0.1:12000> get key1
"123"

Next Steps

Redis Launchpad