[GH-ISSUE #320] self hosted docker example with --cache-file option => "flag provided but not defined: -cache-file" #251

Closed
opened 2026-05-07 00:22:18 +02:00 by BreizhHardware · 3 comments

Originally created by @milksteakjellybeans on GitHub (Jun 11, 2022).
Original GitHub issue: https://github.com/binwiederhier/ntfy/issues/320

Apologies if this is user error, I'm tuning a self hosted server and trying to enable the file based caching.

I'm using a modified version of the example that include the "--cache-file" option, as documented
https://ntfy.sh/docs/install/#docker
and
https://hub.docker.com/r/binwiederhier/ntfy/

When running the example (with some path modifications, and the most recent release), I get the following out put:
"Incorrect Usage. flag provided but not defined: -cache-file"

I reviewed the docs on configuring message cache on disk and I'm not seeing what I'm missing.
(https://ntfy.sh/docs/config/#message-cache)

(I might guess that it's choking on the cache file not yet existing, but if that's the case, I'm not sure how to boot strap the feature to write an initial cache file. touch cache.db?)

Here's the command I ran (modified from example):

# cat run_ntfy_ex1.sh 
docker run \
  -v /home/dude/ntfy/ex/var/cache/ntfy:/var/cache/ntfy \
  -p 80:80 \
  -it \
  binwiederhier/ntfy:v1.25.2 \
    --cache-file /var/cache/ntfy/cache.db \
    serve

And here's the output:

# sh run_ntfy_ex1.sh 
Incorrect Usage. flag provided but not defined: -cache-file

NAME:
   ntfy - Simple pub-sub notification service

USAGE:
   ntfy [OPTION..]

COMMANDS:
   help, h  Shows a list of commands or help for one command
   Client commands:
     publish, pub, send, trigger  Send message via a ntfy server
     subscribe, sub               Subscribe to one or more topics on a ntfy server
   Server commands:
     access  Grant/revoke access to a topic, or show access
     serve   Run the ntfy server
     user    Manage/show users

GLOBAL OPTIONS:
   --debug, -d                           enable debug logging (default: false) [$NTFY_DEBUG]
   --help, -h                            show help (default: false)
   --log-level value, --log_level value  set log level (default: "INFO") [$NTFY_LOG_LEVEL]
   --no-log-dates, --no_log_dates        disable the date/time prefix (default: false) [$NTFY_NO_LOG_DATES]
   --trace                               enable tracing (very verbose, be careful) (default: false) [$NTFY_TRACE]
   

Try 'ntfy COMMAND --help' or https://ntfy.sh/docs/ for more information.

To report a bug, open an issue on GitHub: https://github.com/binwiederhier/ntfy/issues.
If you want to chat, simply join the Discord server (https://discord.gg/cT7ECsZj9w), or
the Matrix room (https://matrix.to/#/#ntfy:matrix.org).

ntfy 1.25.2 (86c132f), runtime go1.18.2, built at 2022-06-03T01:45:19Z
Copyright (C) 2022 Philipp C. Heckel, licensed under Apache License 2.0 & GPLv2
flag provided but not defined: -cache-file

Thanks for reviewing

Originally created by @milksteakjellybeans on GitHub (Jun 11, 2022). Original GitHub issue: https://github.com/binwiederhier/ntfy/issues/320 Apologies if this is user error, I'm tuning a self hosted server and trying to enable the file based caching. I'm using a modified version of the example that include the "--cache-file" option, as documented https://ntfy.sh/docs/install/#docker and https://hub.docker.com/r/binwiederhier/ntfy/ When running the example (with some path modifications, and the most recent release), I get the following out put: "Incorrect Usage. flag provided but not defined: -cache-file" I reviewed the docs on configuring message cache on disk and I'm not seeing what I'm missing. (https://ntfy.sh/docs/config/#message-cache) (I might guess that it's choking on the cache file not yet existing, but if that's the case, I'm not sure how to boot strap the feature to write an initial cache file. touch cache.db?) Here's the command I ran (modified from example): ``` # cat run_ntfy_ex1.sh docker run \ -v /home/dude/ntfy/ex/var/cache/ntfy:/var/cache/ntfy \ -p 80:80 \ -it \ binwiederhier/ntfy:v1.25.2 \ --cache-file /var/cache/ntfy/cache.db \ serve ``` And here's the output: ``` # sh run_ntfy_ex1.sh Incorrect Usage. flag provided but not defined: -cache-file NAME: ntfy - Simple pub-sub notification service USAGE: ntfy [OPTION..] COMMANDS: help, h Shows a list of commands or help for one command Client commands: publish, pub, send, trigger Send message via a ntfy server subscribe, sub Subscribe to one or more topics on a ntfy server Server commands: access Grant/revoke access to a topic, or show access serve Run the ntfy server user Manage/show users GLOBAL OPTIONS: --debug, -d enable debug logging (default: false) [$NTFY_DEBUG] --help, -h show help (default: false) --log-level value, --log_level value set log level (default: "INFO") [$NTFY_LOG_LEVEL] --no-log-dates, --no_log_dates disable the date/time prefix (default: false) [$NTFY_NO_LOG_DATES] --trace enable tracing (very verbose, be careful) (default: false) [$NTFY_TRACE] Try 'ntfy COMMAND --help' or https://ntfy.sh/docs/ for more information. To report a bug, open an issue on GitHub: https://github.com/binwiederhier/ntfy/issues. If you want to chat, simply join the Discord server (https://discord.gg/cT7ECsZj9w), or the Matrix room (https://matrix.to/#/#ntfy:matrix.org). ntfy 1.25.2 (86c132f), runtime go1.18.2, built at 2022-06-03T01:45:19Z Copyright (C) 2022 Philipp C. Heckel, licensed under Apache License 2.0 & GPLv2 flag provided but not defined: -cache-file ``` Thanks for reviewing
BreizhHardware 2026-05-07 00:22:18 +02:00
Author
Owner

@binwiederhier commented on GitHub (Jun 11, 2022):

Thanks for reporting. The serve command is the one with the flag. It should be

docker run \
  -v /var/cache/ntfy:/var/cache/ntfy \
  -p 80:80 \
  -it \
  binwiederhier/ntfy \
    serve \
    --cache-file /var/cache/ntfy/cache.db

I'll fix the docs when I get to it.

<!-- gh-comment-id:1152974543 --> @binwiederhier commented on GitHub (Jun 11, 2022): Thanks for reporting. The `serve` command is the one with the flag. It should be ``` docker run \ -v /var/cache/ntfy:/var/cache/ntfy \ -p 80:80 \ -it \ binwiederhier/ntfy \ serve \ --cache-file /var/cache/ntfy/cache.db ``` I'll fix the docs when I get to it.
Author
Owner

@binwiederhier commented on GitHub (Jun 12, 2022):

Fixed in github.com/binwiederhier/ntfy@3c47797bf3

<!-- gh-comment-id:1153192810 --> @binwiederhier commented on GitHub (Jun 12, 2022): Fixed in https://github.com/binwiederhier/ntfy/commit/3c47797bf3924ee3e89c361bf88d562180f39422
Author
Owner

@aryoxp commented on GitHub (Mar 28, 2025):

The document at Docker Hub has not been updated.

<!-- gh-comment-id:2759877822 --> @aryoxp commented on GitHub (Mar 28, 2025): The document at [Docker Hub](https://hub.docker.com/r/binwiederhier/ntfy) has not been updated.
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#251
No description provided.