update readme

This commit is contained in:
sangyun 2024-01-17 18:36:31 +09:00
parent b47ecfff04
commit 139384cb28
1 changed files with 40 additions and 0 deletions

View File

@ -0,0 +1,40 @@
## Start Docker
```sh
# 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
```yml
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
```