osixia / docker-keepalived

Keepalived container image 🐳🌴
MIT License
403 stars 146 forks source link

Floating IP Stays After Container Is Stopped #2

Closed spirrello closed 8 years ago

spirrello commented 8 years ago

Hi,

Have you seen where the floating IP persists on the host even after the container is stopped? The only way I'm able to remediate this is to reboot.

osixia commented 8 years ago

hello i use fleet (based on systemd) to lauch keepalived container :

[Unit]
Description=Keepalived Service
After=docker.service
Requires=docker.service

[Service]
TimeoutStartSec=0
EnvironmentFile=/etc/environment
EnvironmentFile=/node/environment/keepalived
ExecStartPre=-/usr/bin/docker kill %p
ExecStartPre=-/usr/bin/docker rm -f %p
ExecStartPre=/usr/bin/docker pull osixia/keepalived:0.2.1
ExecStart=/usr/bin/docker run --cap-add=NET_ADMIN --net=host --name %p \
-e KEEPALIVED_INTERFACE=${KEEPALIVED_INTERFACE} \
-e KEEPALIVED_PASSWORD=${KEEPALIVED_PASSWORD} \
-e KEEPALIVED_PRIORITY=${KEEPALIVED_PRIORITY} \
-e KEEPALIVED_VIRTUAL_IPS=${CLUSTER_FAILOVER_IP} \
-e KEEPALIVED_PUBLIC_IP=${KEEPALIVED_PUBLIC_IP} \
-e KEEPALIVED_NOTIFY=/container/run/service/keepalived/assets/notify.sh \
-v /node/share/keepalived/keepalived-notify.sh:/container/service/keepalived/assets/notify.sh:ro \
osixia/keepalived:0.2.1 --copy-service
ExecStop=/usr/bin/docker stop %p
ExecStopPost=/usr/bin/ip addr del ${CLUSTER_FAILOVER_IP}/32 dev ${KEEPALIVED_INTERFACE}
Restart=always
RestartSec=10

[X-Fleet]
Global=true
MachineMetadata=keepalived=true

revelent par is : ExecStopPost=/usr/bin/ip addr del ${CLUSTER_FAILOVER_IP}/32 dev ${KEEPALIVED_INTERFACE}

osixia commented 8 years ago

In version 1.2.24 finish script do this :)