Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BORG_PASSPHRASE_FILE does not set BORG_PASSPHRASE environment variable #325

Closed
valfur03 opened this issue Apr 28, 2024 · 1 comment
Closed

Comments

@valfur03
Copy link

I have the following borgmatic service in my compose.yaml file:

services:
  borgmatic:
    image: ghcr.io/borgmatic-collective/borgmatic:1.8.10
    environment:
      # BORG_PASSPHRASE: 'heremypassphrase'
      BORG_PASSPHRASE_FILE: /run/secrets/BORGMATIC_ENCRYPTION_PASSPHRASE
    volumes:
      - borg-config:/root/.config/borg
      - ./borgmatic/config:/etc/borgmatic.d:ro
      - /backup/borg/docker:/backup
    secrets:
      - BORGMATIC_ENCRYPTION_PASSPHRASE
    restart: unless-stopped

When using the BORGMATIC_PASSPHRASE_FILE, the BORGMATIC_PASSPHRASE is not set inside the container. Initializing repositories or creating archives also asks for my passphrase.

$ docker compose exec borgmatic borgmatic create --verbosity 1 --stats --list
local: Creating archive
Enter passphrase for key /backup/repo:

However, BORGMATIC_PASSPHRASE works as expected when passed as is to the container. It seems that the _FILE variable is not working in my case.

The logs still print this message when starting up:

Setting BORG_PASSPHRASE from the content of /run/secrets/BORGMATIC_ENCRYPTION_PASSPHRASE
Unsetting BORG_PASSPHRASE_FILE

OS: Fedora Linux version 38 (Server Edition)
Docker version: Docker version 25.0.2, build 29cf629
Compose version: Docker Compose version v2.24.5


This issue might be related to #320.

@valfur03
Copy link
Author

After taking a look at the docker entrypoint, I realized my mistake.

The environment variable is meant to be used by crond, not subprocesses like docker compose exec ....

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant