Operations 15 min read

Deploying Portainer for Docker Management and Setting Up Redis Sentinel with Spring Boot Integration

This article guides readers through installing the Portainer Docker management UI, creating Docker‑Compose files for Portainer, deploying a Redis master‑slave cluster with Sentinel, configuring custom bridge networks, and integrating the Sentinel setup into a Spring Boot application using Lettuce and RedisTemplate.

Architecture Digest
Architecture Digest
Architecture Digest
Deploying Portainer for Docker Management and Setting Up Redis Sentinel with Spring Boot Integration

The author introduces Portainer, a graphical Docker management tool, and explains how to install it using a docker-compose file named portainer.yml that maps port 9000 and mounts the Docker socket.

After uploading portainer.yml to the server, the container is started in the foreground with docker-compose -f portainer.yml up , then in detached mode with docker-compose -f portainer.yml up -d . Once Portainer is reachable at ip:9000 , users can create a local endpoint, view containers, images, networks, and manage them through the UI.

Next, the article demonstrates a practical example: deploying a Redis master‑slave architecture with three Sentinel instances using Docker‑Compose. The redis-cluster.yml file defines one master container and two slave containers, each exposing non‑standard ports (16379, 16380, 16381) and setting passwords via the redis-server command.

Sentinel services are described in redis-sentinel.yml , which creates three Sentinel containers, maps ports 26379‑26381, and connects them to a custom bridge network named redis-sentinel . The Sentinel configuration files ( sentinel.conf ) specify the monitored master IP, authentication password, and failover parameters.

A custom bridge network is created in Portainer (Network → Add network → name redis-sentinel ) to isolate the Redis and Sentinel containers from other workloads. Each container is then attached to this network via the Portainer UI.

To verify the setup, the master is stopped through Portainer; the remaining Sentinels automatically elect a new master, which can be observed in their logs. The new master’s IP (e.g., 172.20.0.3 ) is confirmed by inspecting the container details.

Finally, the article shows how to integrate the Redis Sentinel cluster into a Spring Boot application. Dependencies for spring-boot-starter-data-redis and commons-pool2 (Lettuce pool) are added to pom.xml . The Spring configuration sets spring.redis.sentinel.master , spring.redis.sentinel.nodes , and password fields, along with Lettuce pool settings.

Spring’s auto‑configuration creates a LettuceConnectionFactory that prefers Sentinel configuration, falling back to cluster or standalone if Sentinel is absent. The application injects a RedisTemplate and provides REST endpoints to set and get string values, demonstrating successful read/write operations against the Sentinel‑managed Redis cluster.

Code snippets throughout the article are preserved in pre / code blocks, and illustrative screenshots are included via img tags.

DockerSpring BootContainer ManagementDocker ComposePortainerRedis Sentinel
Architecture Digest
Written by

Architecture Digest

Focusing on Java backend development, covering application architecture from top-tier internet companies (high availability, high performance, high stability), big data, machine learning, Java architecture, and other popular fields.

0 followers
Reader feedback

How this landed with the community

login Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.