This commit is contained in:
ofreax
2015-06-09 20:41:43 +02:00
parent 44921f0e18
commit 9d3252cd55
10 changed files with 219 additions and 0 deletions
+27
View File
@@ -0,0 +1,27 @@
FROM osixia/baseimage:0.10.4
MAINTAINER Bertrand Gouny <bertrand.gouny@osixia.net>
# This container need run options :
# --privileged=true
# --net=host
# Use baseimage-docker's init system.
CMD ["/sbin/my_init"]
# Install Keepalived
RUN apt-get -y update \
&& LC_ALL=C DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
keepalived
# Add Keepalived assets
ADD service/keepalived/assets /osixia/keepalived
# Run clean all
RUN apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
# Add default env variables
ADD env.yml /etc/env.yml
# Add Keepalived container start config & daemon
ADD service/keepalived/container-start.sh /etc/my_init.d/keepalived
ADD service/keepalived/daemon.sh /etc/service/keepalived/run
+14
View File
@@ -0,0 +1,14 @@
KEEPALIVED_PASSWORD: d0cker
# for electing MASTER, highest priority wins.
# to be MASTER, make 50 more than other machines
KEEPALIVED_PRIORITY: 150
KEEPALIVED_UNICAST_PEER:
- 172.17.8.101
- 172.17.8.102
- 172.17.8.103
KEEPALIVED_VIRTUAL_IPS:
- 192.168.200.17/24 dev eth1
- 192.168.200.18/24 dev eth2 label eth2:1
@@ -0,0 +1 @@
Add your custom keepalived.conf file here or mount one at docker run to /etc/keepalived/keepalived.conf
@@ -0,0 +1,19 @@
vrrp_instance VI_1 {
interface eno1
state MASTER
virtual_router_id 51
priority {{ keepalived_priority }}
unicast_peer {
{{ peer_ip }}
}
virtual_ipaddress {
{{ floating_ip }}
}
authentication {
auth_type PASS
auth_pass {{ keepalived_password }}
}
}
+22
View File
@@ -0,0 +1,22 @@
#!/bin/bash -e
FIRST_START_DONE="/etc/docker-keepalived-first-start-done"
# container first start
if [ ! -e "$FIRST_START_DONE" ]; then
# config folder is empty use bootstrap config if available
if [ ! -e /etc/keepalived/keepalived.conf ]; then
echo "No keepalived.conf provided using image default one"
if [ ! -e /osixia/keepalived/keepalived.conf ]; then
echo "Error: No default keepalived.conf found in /osixia/keepalived/keepalived.conf"
exit 1
else
ln -s /osixia/keepalived/keepalived.conf /etc/keepalived/keepalived.conf
fi
fi
touch $FIRST_START_DONE
fi
exit 0
+2
View File
@@ -0,0 +1,2 @@
#!/bin/bash -e
exec /usr/sbin/keepalived -f /etc/keepalived/keepalived.conf --dont-fork --log-console