[GH-ISSUE #865] Adding auth-file: "/var/lib/ntfy/user.db" auth-default-access: "read-write" in docker instance problems. #609

Closed
opened 2026-05-07 00:25:50 +02:00 by BreizhHardware · 4 comments

Originally created by @kaumudpa on GitHub (Sep 5, 2023).
Original GitHub issue: https://github.com/binwiederhier/ntfy/issues/865

Hi,

On a docker instance If we add
auth-file: "/var/lib/ntfy/user.db"
auth-default-access: "read-write"

to the server.yml file The docker instance fails to restart. and when these files are removed it works perfectly fine.

Originally created by @kaumudpa on GitHub (Sep 5, 2023). Original GitHub issue: https://github.com/binwiederhier/ntfy/issues/865 Hi, On a docker instance If we add `auth-file: "/var/lib/ntfy/user.db"` `auth-default-access: "read-write"` to the server.yml file The docker instance fails to restart. and when these files are removed it works perfectly fine.
BreizhHardware 2026-05-07 00:25:50 +02:00
  • closed this issue
  • added the
    🪲 bug
    label
Author
Owner

@avoinescu commented on GitHub (Sep 5, 2023):

The problem seems to be the
auth-file: "/var/lib/ntfy/user.db"

If I leave the second one the docker container starts. But can't get the auth part to work ^^

<!-- gh-comment-id:1707017586 --> @avoinescu commented on GitHub (Sep 5, 2023): The problem seems to be the auth-file: "/var/lib/ntfy/user.db" If I leave the second one the docker container starts. But can't get the auth part to work ^^
Author
Owner

@wunter8 commented on GitHub (Sep 5, 2023):

It might be easier to solve this on Discord. But it seems like you're not correctly mounting the /var/lib/ntfy directory inside the Docker container. Or you might be mounting it but the user that is running the container may not have access to that directory. I'd need to know more about your setup

<!-- gh-comment-id:1707036431 --> @wunter8 commented on GitHub (Sep 5, 2023): It might be easier to solve this on Discord. But it seems like you're not correctly mounting the /var/lib/ntfy directory inside the Docker container. Or you might be mounting it but the user that is running the container may not have access to that directory. I'd need to know more about your setup
Author
Owner

@kaumudpa commented on GitHub (Sep 5, 2023):

Its a simple docker instance spinned up via docker-compose as found here https://docs.ntfy.sh/install/#docker

<!-- gh-comment-id:1707044375 --> @kaumudpa commented on GitHub (Sep 5, 2023): Its a simple docker instance spinned up via `docker-compose` as found here https://docs.ntfy.sh/install/#docker
Author
Owner

@kaumudpa commented on GitHub (Sep 5, 2023):

As suggested by @wunter8 on discord.

When using Docker, it's easier to use environment variables to configure everything instead of server.yml. Here's an example docker-compose.yml file with some good default settings.

Working docker-compose config.

version: '3'
services:
  ntfy:
    image: binwiederhier/ntfy
    restart: unless-stopped
    environment:
      NTFY_BASE_URL: <base_url>
      NTFY_AUTH_FILE: /etc/ntfy/auth.db
      NTFY_AUTH_DEFAULT_ACCESS: read-write
      NTFY_BEHIND_PROXY: true
      NTFY_ATTACHMENT_CACHE_DIR: /etc/ntfy/attachments
      NTFY_UPSTREAM_BASE_URL: https://ntfy.sh
      NTFY_ENABLE_LOGIN: true
      NTFY_WEB_PUSH_PUBLIC_KEY: <public_key>
      NTFY_WEB_PUSH_PRIVATE_KEY: <private_key>
      NTFY_WEB_PUSH_FILE: /etc/ntfy/webpush.db
      NTFY_WEB_PUSH_EMAIL_ADDRESS: <email>
    volumes:
      - ./:/etc/ntfy
    ports:
      - 8093:80
    command: serve

All credits to @wunter8 for this solution.

<!-- gh-comment-id:1707146928 --> @kaumudpa commented on GitHub (Sep 5, 2023): As suggested by @wunter8 on discord. When using Docker, it's easier to use environment variables to configure everything instead of server.yml. Here's an example docker-compose.yml file with some good default settings. Working docker-compose config. ``` version: '3' services: ntfy: image: binwiederhier/ntfy restart: unless-stopped environment: NTFY_BASE_URL: <base_url> NTFY_AUTH_FILE: /etc/ntfy/auth.db NTFY_AUTH_DEFAULT_ACCESS: read-write NTFY_BEHIND_PROXY: true NTFY_ATTACHMENT_CACHE_DIR: /etc/ntfy/attachments NTFY_UPSTREAM_BASE_URL: https://ntfy.sh NTFY_ENABLE_LOGIN: true NTFY_WEB_PUSH_PUBLIC_KEY: <public_key> NTFY_WEB_PUSH_PRIVATE_KEY: <private_key> NTFY_WEB_PUSH_FILE: /etc/ntfy/webpush.db NTFY_WEB_PUSH_EMAIL_ADDRESS: <email> volumes: - ./:/etc/ntfy ports: - 8093:80 command: serve ``` All credits to @wunter8 for this solution.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/ntfy#609
No description provided.