init
This commit is contained in:
parent
2df1fb5c42
commit
0d5963eb5e
12
README.md
12
README.md
|
@ -1,2 +1,10 @@
|
|||
# docker-keepalived
|
||||
A docker image to run Keepalived
|
||||
# osixia/keepalived
|
||||
|
||||
A docker image to run Keepalived.
|
||||
> [keepalived.org](http://keepalived.org/)
|
||||
|
||||
## Quick start
|
||||
|
||||
This image need to be run with : --privileged --net=host
|
||||
|
||||
docker run --privileged --net=host -d osixia/keepalived
|
||||
|
|
|
@ -1,26 +1,31 @@
|
|||
FROM osixia/baseimage:0.10.4
|
||||
MAINTAINER Bertrand Gouny <bertrand.gouny@osixia.net>
|
||||
|
||||
# This container need run options :
|
||||
# --privileged=true
|
||||
# --net=host
|
||||
# -v /lib/modules:/lib/modules
|
||||
|
||||
# sudo docker run --privileged=true --net=host -v /lib/modules:/lib/modules -d osixia/keepalived:0.1.0
|
||||
# Keepalived version
|
||||
ENV KEEPALIVED_VERSION 1.2.17
|
||||
|
||||
# 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
|
||||
&& LC_ALL=C DEBIAN_FRONTEND=noninteractive apt-get install -y \
|
||||
make gcc libssl-dev \
|
||||
&& curl -o keepalived.tar.gz -SL http://keepalived.org/software/keepalived-${KEEPALIVED_VERSION}.tar.gz \
|
||||
&& mkdir -p /osixia/keepalived-sources \
|
||||
&& tar -xzf keepalived.tar.gz --strip 1 -C /osixia/keepalived-sources \
|
||||
&& cd osixia/keepalived-sources \
|
||||
&& ./configure --with-kernel-dir=/lib/modules/$(uname -r)/build \
|
||||
&& make && make install \
|
||||
&& cd - && mkdir -p /etc/keepalived \
|
||||
&& apt-get remove -y --purge --auto-remove make gcc libssl-dev
|
||||
|
||||
# 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/*
|
||||
# Clean all
|
||||
RUN rm keepalived.tar.gz \
|
||||
&& apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
|
||||
|
||||
# Add default env variables
|
||||
ADD env.yml /etc/env.yml
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
KEEPALIVED_INTERFACE: wlan0
|
||||
KEEPALIVED_INTERFACE: p4p1
|
||||
KEEPALIVED_PASSWORD: d0cker
|
||||
|
||||
# for electing MASTER, highest priority wins.
|
||||
|
@ -6,7 +6,7 @@ KEEPALIVED_PASSWORD: d0cker
|
|||
KEEPALIVED_PRIORITY: 150
|
||||
|
||||
KEEPALIVED_UNICAST_PEERS:
|
||||
- 192.168.1.9
|
||||
- 192.168.1.10
|
||||
|
||||
KEEPALIVED_VIRTUAL_IPS:
|
||||
- 192.168.1.230
|
||||
- 192.168.1.231
|
||||
|
|
|
@ -10,7 +10,9 @@ vrrp_instance vip-1 {
|
|||
priority {{ keepalived_priority }}
|
||||
nopreempt
|
||||
|
||||
unicast_peer {{ keepalived_unicast_peers }}
|
||||
unicast_peer {
|
||||
{{ keepalived_unicast_peers }}
|
||||
}
|
||||
|
||||
virtual_ipaddress {
|
||||
{{ keepalived_virtual_ips }}
|
||||
|
@ -20,7 +22,4 @@ vrrp_instance vip-1 {
|
|||
auth_type PASS
|
||||
auth_pass {{ keepalived_password }}
|
||||
}
|
||||
|
||||
debug
|
||||
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#!/bin/bash -ex
|
||||
#!/bin/bash -e
|
||||
|
||||
FIRST_START_DONE="/etc/docker-keepalived-first-start-done"
|
||||
|
||||
|
@ -12,6 +12,7 @@ if [ ! -e "$FIRST_START_DONE" ]; 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
|
||||
|
||||
#
|
||||
|
@ -51,6 +52,7 @@ if [ ! -e "$FIRST_START_DONE" ]; then
|
|||
done
|
||||
sed -i "/{{ keepalived_virtual_ips }}/d" /etc/keepalived/keepalived.conf
|
||||
fi
|
||||
|
||||
fi
|
||||
|
||||
touch $FIRST_START_DONE
|
||||
|
|
|
@ -1,2 +1,2 @@
|
|||
#!/bin/bash -e
|
||||
exec /usr/sbin/keepalived -f /etc/keepalived/keepalived.conf --dont-fork --log-console -D -d
|
||||
exec /usr/local/sbin/keepalived -f /etc/keepalived/keepalived.conf --dont-fork --log-console -D -d
|
||||
|
|
Loading…
Reference in New Issue