osixia / docker-keepalived

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

startup failes with own keepalived.conf #24

Closed setiseta closed 5 years ago

setiseta commented 6 years ago

First of all thank you for providing this image. it works great. But i think i found a bug, or maybe its classified as improvment

The startup failes if there is a own keepalived.conf configured. within docker-compose file:

...
    volumes:
      - ./keepalived.conf:/container/service/keepalived/assets/keepalived.conf

The error is:

sed: can't move '/container/service/keepalived/assets/keepalived.confBHIheG' to '/container/service/keepalived/assets/keepalived.conf': Resource busy

so i found that there is a check on first-run and if first run is not done, the sed commands try to replace things in config from the environment. so it was needed to also map that firstrun ist done.

    volumes:
      - ./keepalived.conf:/container/service/keepalived/assets/keepalived.conf
      - ./keepalived-first-start-done:/container/run/state/docker-keepalived-first-start-done

maybe there should be a flag to disable the sed commands when using own keepalived.conf.

anannaya commented 5 years ago

@setiseta Did u try the same image in kubernetes? I have mounted the keepalived-first-start-done file .. still i am getting the same error.

BertrandGouny commented 5 years ago

@anannaya & @setiseta did you try to run the container with --copy-service command argument ?

docker run [...] osixia/keepalived --copy-service
anannaya commented 5 years ago

@BertrandGouny Sorry i did not update the issue --copy-service option was worked for me. Thank you so much for response.

setiseta commented 5 years ago

@BertrandGouny no I've overseen this option. with the option it seems to work.