packaged by Chainguard
Contact our team to test out this image for free. Please also indicate any other images you would like to evaluate.
Keepalived implements the Virtual Router Redundancy Protocol (VRRP) so a virtual IP can fail over between routers, and drives the Linux Virtual Server (IPVS) kernel load balancer with health checkers that add and remove real servers as they come and go.
Chainguard Containers are regularly-updated, secure-by-default container images.
For those with access, this container image is available on cgr.dev:
Be sure to replace the ORGANIZATION placeholder with the name used for your organization's private repository within the Chainguard Registry.
The keepalived project does not publish a container image, so there is no upstream
image to be a drop-in replacement for. Upstream ships a Dockerfile.in template in
its source tree that users build themselves, and this image follows it: the
entrypoint is the same, and the binary is reachable at both /usr/sbin/keepalived
and /usr/bin/keepalived.
One deliberate difference: no configuration file ships in the image.
Upstream's Dockerfile copies a demo keepalived.conf that claims the address
10.247.254.2 on eth0. Since nothing else advertises for that virtual router, a
container started with it wins the election and takes that address on whatever
network it joins. Mount your own configuration instead, as described below. This
also matches upstream's own make install, which stopped installing a default
keepalived.conf after v2.2.4 and ships only keepalived.conf.sample.
A commented reference configuration is included at
/etc/keepalived/keepalived.conf.sample.
keepalived manages addresses and routes on a real network interface, so the container needs:
CAP_NET_ADMIN and CAP_NET_RAW,/run: keepalived writes keepalived.pid, keepalived_vrrp.pid and
keepalived_checkers.pid there. Under a read-only root filesystem, mount a
writable volume at /run, or the pid-file open fails and keepalived reports it
as daemon is already running, andinterface to that
host's actual NIC name: keepalived exits if the interface does not exist, and it
is often not eth0.VRRP uses IP protocol 112 to the multicast group 224.0.0.18 rather than a TCP
port, so no ports are published. Where multicast is unavailable, configure
unicast_peer instead.
Write a configuration and mount it over /etc/keepalived/keepalived.conf. This
example makes the container the VRRP master for a virtual IP on eth0; with
--network host that is the host's interface name, so substitute your own
everywhere eth0 appears below:
With no peer advertising a higher priority, the instance is promoted after the advertisement interval:
and the virtual IP is assigned to the interface:
Bring up a second node with a lower priority and the same virtual_router_id to
see the address move when the master stops.
Before starting the daemon, you can check a configuration without running it:
keepalived itself is configured entirely through
/etc/keepalived/keepalived.conf; it reads no environment variables of its own.
The image does honour CHAINGUARD_LEGACY_ALLOWED=0, which deactivates OpenSSL's
legacy provider and so disables the MD5 used by auth_type AH and by the
url { digest } checker option. The entrypoint runs the daemon in the foreground with
--dont-fork --log-console, so it logs to stderr rather than to a file inside the
container. docker logs shows it; pipe with 2>&1 when grepping.
Health checkers are the other half of a typical configuration. IPVS is a kernel
facility, so the ip_vs module must already be loaded on the host: the image ships
no modprobe, and without it keepalived logs IPVS: Can't initialize ipvs and
silently stops load balancing.
This virtual_server load balances two backends and removes one automatically when
its HTTP check fails:
To pin a checker to a response body rather than a status code, compute the digest
with the genhash tool the image also ships:
If you use notify or vrrp_script hooks, keepalived runs them as the
keepalived_script user, which this image creates. Scripts must be readable and
executable by that user, and every directory in the path to the script must be
owned by root and not writable by anyone else, or enable_script_security refuses
to run them.
This image ships no shell or interpreter, so a hook must be an executable the
kernel can run directly -- a dynamically linked ELF binary is fine, as long as its
libraries are in the image. A #!/bin/sh script fails to exec, and a command
written as a shell string is run through system(), which also needs a shell.
Add busybox with Custom Assembly
if your hooks need one.
keepalived's parent process stays alive if the VRRP child exits transiently, so a
container can look healthy while doing nothing. It does exit on a configuration
error, a fatal error or a missing permission, so container liveness catches those.
For everything else, watch for Entering MASTER STATE or poll the virtual IP
rather than relying on container liveness alone.
This image is built with VRRP, LVS/IPVS, BFD, nftables, iptables, ipset, SNMP
(including the RFC VRRP MIBs), DBus, JSON and regex support compiled in. SNMP is
an AgentX subagent, so it needs a master agent reachable at /var/agentx/master;
neither that socket nor its directory exists in the image, so mount the socket in
from a master agent on the host. Run
docker run --rm --entrypoint /usr/bin/keepalived cgr.dev/ORGANIZATION/keepalived:latest -v
to print the full list.
Chainguard's free tier of Starter container images are built with Wolfi, our minimal Linux undistro.
All other Chainguard Containers are built with Chainguard OS, Chainguard's minimal Linux operating system designed to produce container images that meet the requirements of a more secure software supply chain.
The main features of Chainguard Containers include:
For cases where you need container images with shells and package managers to build or debug, most Chainguard Containers come paired with a development, or -dev, variant.
In all other cases, including Chainguard Containers tagged as :latest or with a specific version number, the container images include only an open-source application and its runtime dependencies. These minimal container images typically do not contain a shell or package manager.
Although the -dev container image variants have similar security features as their more minimal versions, they include additional software that is typically not necessary in production environments. We recommend using multi-stage builds to copy artifacts from the -dev variant into a more minimal production image.
To improve security, Chainguard Containers include only essential dependencies. Need more packages? Chainguard customers can use Custom Assembly to add packages, either through the Console, chainctl, or API.
To use Custom Assembly in the Chainguard Console: navigate to the image you'd like to customize in your Organization's list of images, and click on the Customize image button at the top of the page.
Refer to our Chainguard Containers documentation on Chainguard Academy. Chainguard also offers VMs and Libraries — contact us for access.
This software listing is packaged by Chainguard. The trademarks set forth in this offering are owned by their respective companies, and use of them does not imply any affiliation, sponsorship, or endorsement by such companies.
Chainguard's container images contain software packages that are direct or transitive dependencies. The following licenses were found in the "latest" tag of this image:
( GPL-2.0-or-later
Apache-2.0
BSD-1-Clause
BSD-2-Clause
BSD-3-Clause
BSD-4-Clause-UC
CC-PDDC
For a complete list of licenses, please refer to this Image's SBOM.
Software license agreementChainguard Containers are SLSA Level 3 compliant with detailed metadata and documentation about how it was built. We generate build provenance and a Software Bill of Materials (SBOM) for each release, with complete visibility into the software supply chain.
SLSA compliance at ChainguardThis image helps reduce time and effort in establishing PCI DSS 4.0 compliance with low-to-no CVEs.
PCI DSS at ChainguardA FIPS validated version of this image is available for FedRAMP compliance. STIG is included with FIPS image.