borgmatic-collective / docker-borgmatic

Borgmatic in Docker
GNU General Public License v3.0
350 stars 92 forks source link

Documentation improvement for Docker control before/after backup #343

Open Bubbelb opened 2 months ago

Bubbelb commented 2 months ago

Hi there,

Since a few days I have been toying with the docker container of borgmatic. I found a few (small) things I think are worth noting in the Readme to get others started:

  1. The Environment variable DOCKERCLI='true' needs to be set on your docker command line, or compose.yaml, the docker client executables are being installed, which helps a great deal controlling containers.
  2. With that, of course a bind mount must exist as follows: /var/run/docker.sock:/var/run/docker.sock
  3. To stop and start containers, I did the following in the config file:
    
    ...
    constants:
    ...
    containernames: "container-a container-b container c"
    ...
    before_backup:
    - echo {containernames} | xargs docker stop

after_backup:

Hope this helps someone :)

callumhauber commented 2 weeks ago

Thank you! I was having issues with using the REST API from the readme. I could stop a container, but starting a container was giving me "context canceled."

With DOCKERCLI='true' & docker start/stop {container} everything is working how it should now.