How to Set Up Redis with Docker: Fixed IP and Basic Commands Tutorial

Опубликовано: 24 Июль 2026
на канале: German Gerken
1,892
25

Redis is a high-performance, in-memory, multi-model database known for its sub-millisecond latency and versatility. In this video, I’ll guide you through setting up Redis in Docker and ensuring your container has a fixed IP address for consistent access. We’ll also explore Redis’s unique features, such as its ability to combine memory speed with durable persistence and its support for multiple data models like graphs, JSON, and more.

By the end of this tutorial, you’ll have a fully functional Redis setup, ready to handle your data needs—whether as a cache, a primary database, or a multi-model powerhouse. Let’s get started!

Links:
GitHub Repository (Code and examples): https://github.com/GermanGerken/redis...
My LinkedIn (Let’s connect!):   / german-gerken  

Commands Used in the Video:

Step 1: Pull the Redis Image
Download the official Redis image from Docker Hub.

docker pull redis

Step 2: Create a Custom Docker Network
Set up a Docker network with a specific subnet to assign a fixed IP address to your Redis container.

docker network create \
--subnet=192.168.1.0/24 \
redis-network

Step 3: Run the Redis Container with a Fixed IP Address
Start the Redis container and assign it a fixed IP address for consistent access.

docker run --name redis-server \
--net redis-network \
--ip 192.168.1.100 \
-d redis

Step 4: Verify the Container is Running
Check if the Redis container is up and running.

docker ps

Step 5: Find the Container’s IP Address (Optional)
Double-check the container’s assigned IP address.

docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' redis-server

Step 6: Connect to Redis Using Redis CLI
Access the Redis CLI to interact with your database.

docker exec -it redis-server redis-cli

Step 7: Basic Redis Commands
Set a key-value pair:

SET mykey 'Hello, Redis!'

Retrieve a value by key:

GET mykey

Highlights:
Install Redis using Docker.
Assign a fixed IP address to your Redis container.
Interact with Redis via the CLI using simple commands.
Learn why Redis is more than just a cache and how it can be used as a multi-model database.
If you found this video helpful, please like, comment, and subscribe for more tech tutorials and insights. Thanks for watching!