All eyes on AI: 2026 predictions The shifts that will shape your stack.

Read now
For operatorsHow to Deploy and Run Redis in a Docker Container

#Prerequisites

Ensure that Docker is installed on your system. Follow Docker's installation guide if you haven't installed it yet.

#Step 1: Run the Redis container

Execute the following command to run the Redis container in the background in "detached" mode.
where my-redis-stack is the name of the Docker container, -d represents running Redis in the background in "detached" mode, and redis/redis-stack-server is the name of the Docker image fetched from Docker Hub.

#Step 2: Verify that the Redis container is running

#Step 3: Connect to your database

The following uses the first three alphanumeric characters of your Container ID and opens up the sh shell of the Redis Docker container:

#Step 4: Testing Redis container

Execute the following command to test the Redis server:

#Step 5: Running Redis container with Persistent Storage

In order to enable persistence, you should invoke the Docker container, passing the appendonly yes option as shown below:
Check ls -ld /Users/my-redis/ on your host machine to view the directory permissions.
If persistence is enabled, data is stored in the volume /data, which can be used with --volumes-from some-volume-container or -v /docker/host/dir:/data.