Deploying Redis on Docker Desktop for Windows

To deploy Redis using Docker Desktop on Windows, follow a streamlined process that leverages containerization for consistent, isolated environments.

Prerequisites

Ensure Docker Desktop for Windows is installed and running. Verify its status via the system tray icon or by opening the Docker application. A successful startup confirms the Docker daemon is active and ready to manage containers.

Pulling the Redis Image

Open a terminal (PowerShell or Command Prompt) and execute the following commend to download the official Redis image from Docker Hub:

docker pull redis:latest

This retrieves the most recent stable version of Redis. While not mandatory—Docker auto-pulls if the image is missing—the explicit pull ensures you're aware of the version being used.

Starting the Redis Container

Launch a Redis container with persistent port binding and a custom name:

docker run -d \
  --name redis-instance \
  -p 6379:6379 \
  redis:latest
  • -d runs the container in detached mode (background).
  • --name redis-instance assigns a human-readable identifier to the container.
  • -p 6379:6379 maps port 6379 on the host to the same port inside the container, enabling external connections.
  • redis:latest specifies the image to use.

Verify the container is running with:

docker ps

You should see an entry for redis-instance with status Up and port mapping 0.0.0.0:6379->6379/tcp.

Accessing the Redis CLI

To interact with the Redis server directly, execute the Redis commmand-line interface inside the running container:

docker exec -it redis-instance redis-cli
  • docker exec runs a command within a running container.
  • -it allocates a pseudo-TTY and keeps stdin open for interactive use.
  • redis-cli launches the Redis client, providing a prompt where you can issue commands like PING, SET key value, or GET key.

Test connectivity by typing PING and presing Enter. A response of PONG confirms the server is operational.

Optional: Verify External Access

From another terminal or application (e.g., RedisInsight, Python script, or Redis desktop manager), connect to localhost:6379 to confirm the service is accessible outside the container.

Tags: Redis docker containerization Windows Docker Desktop

Posted on Fri, 25 Sep 2026 16:27:51 +0000 by patrick87