osixia / docker-keepalived

Keepalived container image 🐳🌴
MIT License
395 stars 143 forks source link

Issues running on Ubuntu Server 16.04.6 #41

Open GiganteX opened 3 years ago

GiganteX commented 3 years ago

I switched from CoreOS to Ubuntu Server 16.04.6 and ran into issues. I have to run keepalived version 2.0.16 because the higher version require a newer kernel

Still, I get these errors:

me@server:~$ docker run -d --name keepalived \
--env KEEPALIVED_UNICAST_PEERS="#PYTHON2BASH:['192.168.1.52']" \
--env KEEPALIVED_VIRTUAL_IPS=192.168.1.99/32 \
--env KEEPALIVED_INTERFACE=eth1 \
osixia/keepalived:2.0.16

e386a377465cc16b8a83d3ed47a9dc93af3557e7d30e262b56c8267cf9ccb626

me@server:~$ docker logs keepalived

*** CONTAINER_LOG_LEVEL = 3 (info)
*** Search service in CONTAINER_SERVICE_DIR = /container/service :
*** link /container/service/keepalived/startup.sh to /container/run/startup/keepalived
*** link /container/service/keepalived/process.sh to /container/run/process/keepalived/run
*** link /container/service/keepalived/finish.sh to /container/run/process/keepalived/finish
*** Set environment for startup files
*** Environment files will be proccessed in this order :
Caution: previously defined variables will not be overriden.
/container/environment/99-default/default.yaml

To see how this files are processed and environment variables values,
run this container with '--loglevel debug'
*** Running /container/run/startup/keepalived...
*** Set environment for container process
*** Environment files will be proccessed in this order :
Caution: previously defined variables will not be overriden.
/container/environment/99-default/default.yaml

To see how this files are processed and environment variables values,
run this container with '--loglevel debug'
*** Running /container/run/process/keepalived/run...
Waiting config file /usr/local/etc/keepalived/keepalived.confok
Thu Jul 30 16:04:21 2020: Starting Keepalived v2.0.16 (05/03,2019), git commit v2.0.15-96-g4d492740+
Thu Jul 30 16:04:21 2020: Running on Linux 4.15.0-45-generic #48~16.04.1-Ubuntu SMP Tue Jan 29 18:03:48 UTC 2019 (built for Linux 4.4.6)
Thu Jul 30 16:04:21 2020: Command line: '/usr/local/sbin/keepalived' '-f' '/usr/local/etc/keepalived/keepalived.conf'
Thu Jul 30 16:04:21 2020:               '--dont-fork' '--log-console' '--log-detail' '--dump-conf'
Thu Jul 30 16:04:21 2020: Opening file '/usr/local/etc/keepalived/keepalived.conf'.
Thu Jul 30 16:04:21 2020: Failed to bind to process monitoring socket - errno 1 - Operation not permitted
Thu Jul 30 16:04:21 2020: Starting VRRP child process, pid=45
Thu Jul 30 16:04:21 2020: Registering Kernel netlink reflector
Thu Jul 30 16:04:21 2020: Registering Kernel netlink command channel
Thu Jul 30 16:04:21 2020: WARNING - default interface eth1 doesn't exist
Thu Jul 30 16:04:21 2020: Opening file '/usr/local/etc/keepalived/keepalived.conf'.
Thu Jul 30 16:04:21 2020: (Line 6) WARNING - interface eth1 for vrrp_instance VI_1 doesn't exist
Thu Jul 30 16:04:21 2020: WARNING - default user 'keepalived_script' for script execution does not exist - please create.
Thu Jul 30 16:04:21 2020: Non-existent interface specified in configuration
Thu Jul 30 16:04:21 2020: Stopped - used 0.001016 user time, 0.000000 system time
Thu Jul 30 16:04:21 2020: Keepalived_vrrp exited with permanent error CONFIG. Terminating
Thu Jul 30 16:04:21 2020: Stopped Keepalived v2.0.16 (05/03,2019), git commit v2.0.15-96-g4d492740+
*** /container/run/process/keepalived/run exited with status 0
*** Running /container/run/process/keepalived/finish...
Unknown state
*** Killing all processes...

What's wrong and how can I fix it? This worked fine in CoreOS...

orenye commented 3 years ago

You should add --cap-add=NET_ADMIN and probably you would also want to set --net=host

linkvt commented 3 years ago

@GiganteX you need to check how the interface is named inside your container if you decide to change the default

docker run --rm -it --entrypoint bash osixia/keepalived:2.0.16
bash-4.3# ip link
...

Also check the README as orenye commented.

@BertrandGouny you can close this issue.