Before developing ojster I decrypted my environment variables with ansible-vault and injected them when running docker compose up. While this worked I found it had several downsides.
- You can't see which environment variables (keys) are present in the vault, unless you decrypt the entire vault
- You need the private key to add new environment variables
- This approach requires wrapping around the
docker compose upcommand - The decrypted environment variable values end up in the container spec and may leak (visible via
docker inspect, Portainer, logs etc.)
So I tried to migrate my secrets to native file based Docker secrets, but this has 2 issues:
- You can't safely manage Docker secrets through Git
- Many images expect secrets as environment variables instead of files