osixia / docker-keepalived

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

New config isnt copied on container restart #49

Open defcon84 opened 3 years ago

defcon84 commented 3 years ago

Everytime i update the linked keepalived config on the host, i need to stop and remove the container, then create it again. A container restart, recreate or edit(re-deploy through Portainer) does not copy the changed config file to the local folder.

I now do this:

sudo docker container stop keepalived
sudo docker container rm keepalived
sudo docker-compose up -d

And to test if the new config is loaded sudo docker exec keepalived cat /usr/local/etc/keepalived/keepalived.conf

It should copy and use the new config file on every (re)start.

I use the following docker-compose config:

  keepalived:
    container_name: keepalived
    image: osixia/keepalived:2.0.20
    network_mode: host
    pid: host
    volumes:
      - /srv/docker/keepalived/keepalived.conf:/container/service/keepalived/assets/keepalived.conf
    restart: always
    cap_add:
      - NET_ADMIN
      - NET_BROADCAST
      - NET_RAW
    command: [--copy-service, --loglevel, debug]
    environment:
      KEEPALIVED_COMMAND_LINE_ARGUMENTS: >-
        --log-detail
        --log-console