#docker #keepalived #HA #high-availability
Go to file
sangyun 139384cb28 update readme 2024-01-17 18:36:31 +09:00
Dockerfile dockerfile update 2024-01-17 18:28:37 +09:00
README.md update readme 2024-01-17 18:36:31 +09:00
docker-compose.yml initial create 2024-01-17 15:49:25 +09:00
keepalived.sh initial create 2024-01-17 15:49:25 +09:00
keepalived.tmpl fix keepalive error in config file 2024-01-17 17:29:05 +09:00
run.sh fix keepalive error in config file 2024-01-17 17:29:05 +09:00

README.md

Start Docker

# build dockerfile
sudo docker build -t keepalived .

# docker run
sudo docker run -d --rm \
--cap-add=NET_ADMIN \
--net=host \
-e KEEPALIVED_ROUTER_ID=1 \
-e KEEPALIVED_STATE=MASTER \
-e KEEPALIVED_PRIORITY=100 \
-e KEEPALIVED_PASSWORD=1111 \
-e KEEPALIVED_INTERFACE=ovs_eth0 \
-e KEEPALIVED_UNICAST_PEERS=192.168.0.100,192.168.0.246 \
-e KEEPALIVED_VIRTUAL_IPS=192.168.0.180 \
keepalived

Start docker compose

version: '3.5'

services:
  keepalived:
    build: .
    environment:
      KEEPALIVED_ROUTER_ID: 1               # [require] RouterID
      KEEPALIVED_STATE: MASTER              # Defualt State MASTER, BACKUP, default : BACKUP
      KEEPALIVED_PRIORITY: 100              # priority, defualt : 1~199 random
      KEEPALIVED_PASSWORD: 1111             # auth password
      KEEPALIVED_INTERFACE: ovs_eth0        # [require] network interface in host
      KEEPALIVED_UNICAST_PEERS: 192.168.0.100,192.168.0.246 # [require] peer clients, split comma
      KEEPALIVED_VIRTUAL_IPS: 192.168.0.180 # [require] virtual ip, split comma
    network_mode: host
    cap_add:
      - NET_ADMIN