# How to avoid kopia repo password in docker compose file?

**URL:** <https://kopia.discourse.group/t/how-to-avoid-kopia-repo-password-in-docker-compose-file/8789>\
**Category:** General Topics\
**Created:** [January 26, 2026, 8:15pm UTC](https://kopia.discourse.group/t/how-to-avoid-kopia-repo-password-in-docker-compose-file/8789 "2026-01-26T20:15:25Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![revolving-leslie](https://yyz2.discourse-cdn.com/free1/user_avatar/kopia.discourse.group/revolving-leslie/32/1936_2.png) [@revolving-leslie](https://kopia.discourse.group/u/revolving-leslie)\
**Post date:** [January 26, 2026, 8:15pm UTC](https://kopia.discourse.group/t/how-to-avoid-kopia-repo-password-in-docker-compose-file/8789/1 "2026-01-26T20:15:25Z")

</div>

Hello,

I have been successfully using Kopia running in a docker container on my nas but I rather than store the repo password in the docker compose file, I would like to instead refernece it to a text file stored on an encrypted drive. See my file below to see what I mean. Is this possible?

```auto
services:
  kopia:
    image: kopia/kopia:latest
    container_name: Kopia
    restart: unless-stopped
    ports:
      - 51515:51515
    environment:
      - PUID=1000
      - PGID=100
      - TZ=Europe/London
      - KOPIA_PASSWORD=/srv/dev-disk-by-uuid-a2ac4a78-df8f-434e-a731-43c1a33b4708/kopia_pass.txt
      # FORCES PERSISTENT CACHE AND LOGS
      - KOPIA_CACHE_DIRECTORY=/app/cache
      - KOPIA_LOG_DIR=/app/logs
    volumes:
      # THE PASSWORD FILE
      - /srv/dev-disk-by-uuid-a2ac4a78-df8f-434e-a731-43c1a33b4708/kopia_pass.txt:/run/secrets/kopia_pass.txt:ro
      # THE CONFIG (Primary Drive)
      - /srv/dev-disk-by-uuid-fef97aeb-b887-4334-bdcb-ca42c0c70724/docker/data/kopia/config:/app/config
      # THE CACHE & LOGS (Primary Drive)
      - /srv/dev-disk-by-uuid-fef97aeb-b887-4334-bdcb-ca42c0c70724/docker/data/kopia/kopia-cache:/app/cache
      - /srv/dev-disk-by-uuid-fef97aeb-b887-4334-bdcb-ca42c0c70724/docker/data/kopia/kopia-logs:/app/logs
      # THE REPOSITORY (Backup Drive)
      - /srv/dev-disk-by-uuid-78e6e40e-971d-4ec4-81e1-24675308ae1f/kopia_repo:/repository
      # THE SOURCE (Primary Drive)
      - /srv/dev-disk-by-uuid-fef97aeb-b887-4334-bdcb-ca42c0c70724:/entire_primary_drive:ro
      # Restores point
      - /srv/dev-disk-by-uuid-fef97aeb-b887-4334-bdcb-ca42c0c70724/kopia_restores:/restores
      # Offsite backup usd drive
      - /srv/dev-disk-by-uuid-7245e43a-6e35-40be-aba6-ed5de910ce62/kopia_repo:/offsite_repo
      # Encrypted drive
      - /srv/dev-disk-by-uuid-a2ac4a78-df8f-434e-a731-43c1a33b4708/Encrypted:/Encrypted

    command:
      - server
      - start
      - --disable-csrf-token-checks
      - --insecure
      - --address=0.0.0.0:51515
      - --server-username=leslie
      - --server-password=anything

```

---

<div class="post-metadata">

**Author:** ![mabod](https://yyz2.discourse-cdn.com/free1/user_avatar/kopia.discourse.group/mabod/32/941_2.png) [@mabod](https://kopia.discourse.group/u/mabod)\
**Post date:** [February 25, 2026, 11:09pm UTC](https://kopia.discourse.group/t/how-to-avoid-kopia-repo-password-in-docker-compose-file/8789/2 "2026-02-25T23:09:21Z")

</div>

You could try a passwordfile, map it into the container and use it in the command section of the docker compose file:

```auto
volumes:
  - /fullpath/on/host/your_kopia_pass.txt:/kopia_pass_in_container.txt:ro
command:
  - server
  - start
  - --password-file=/kopia_pass_in_container.txt

```
