Advertisement
Beginner Redis, Redis with Docker & Kubernetes

How do you run a basic Redis instance using Docker?

Short answer

You use the docker run command with the official Redis image, optionally mapping the container's port to a port on your host machine, letting you quickly start a working Redis instance for local development or testing without needing to install Redis directly on your machine.

Save Redis mock interview
Advertisement
AModel answer
You use the docker run command with the official Redis image, optionally mapping the container's port to a port on your host machine, letting you quickly start a working Redis instance for local development or testing without needing to install Redis directly on your machine.
docker run --name my-redis -p 6379:6379 -d redis:latest
Real-world example
A developer quickly spins up a local Redis instance for testing using Docker, avoiding the need to install and configure Redis directly on their development machine.
Likely follow-ups
  • How do you persist Redis data across container restarts using Docker?
  • How do you connect to a Redis instance running inside a Docker container?
Related topics