Alpine Based keepalived image
2.6K
A high-performance, ultra-lightweight Keepalived container based on Alpine Linux 3.23. This image is stripped of heavy frameworks (no Python, no Osixia-bloat) to provide a minimal footprint and maximum security.
stdout/stderr for seamless integration with docker logs.keepalived_script user to securely execute healthcheck scripts.Perfect for standard Master/Backup setups. Configuration is generated automatically at startup.
services:
keepalived:
image: ghcr.io/your-username/keepalived:latest
cap_add:
- NET_ADMIN
- NET_RAW
network_mode: host # Required for VRRP
environment:
- STATE=MASTER
- MYIF=eno1 # Recommended: prioritized over INTERFACE
- VIRTUAL_IP=192.168.1.100/24
- PRIORITY=101
- ROUTER_ID=51
If you need complex features like Unicast Peers, multiple VRRP instances, or health-check scripts, mount your own configuration.
services:
keepalived:
image: ghcr.io/your-username/keepalived:latest
cap_add:
- NET_ADMIN
- NET_RAW
network_mode: host
volumes:
- ./my-keepalived.conf:/etc/keepalived/keepalived.conf:ro
| Variable | Description | Default |
|---|---|---|
STATE | Initial VRRP state (MASTER or BACKUP) | MASTER |
MYIF | Primary network interface (takes precedence over INTERFACE) | - |
INTERFACE | Fallback network interface to bind the VRRP instance | eth0 |
VIRTUAL_IP | The VIP address (CIDR format recommended) | - (Required) |
PRIORITY | VRRP priority value (Higher value = Higher priority) | 100 |
ROUTER_ID | Unique VRRP Router ID (0-255) | 51 |
DEBUG | Enable verbose trace (true or false) | false |
docker build -t my-keepalived .
The image is built and pushed automatically on every tag or push to main. The build process uses multi-stage builds to ensure the final image contains no build-time dependencies.
docker logs -f keepalived
docker exec -it keepalived cat /etc/keepalived/keepalived.conf
docker exec -it keepalived ip addr show
If this container starts before the network interface or the configuration mount is ready (common during server reboots), it will:
UP.ip addr, ip route) before launching the binary.Healthcheck scripts are executed by the keepalived_script user for security. Ensure your scripts are readable by this user.
This project is licensed under the MIT License - see the LICENSE file for details.
Content type
Image
Digest
sha256:1910fd15b…
Size
7.5 MB
Last updated
about 23 hours ago
docker pull cobra1978/keepalived:2.4.1