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

Unknown flag --run-cmd #2025

Open
JonahGroendal opened this issue Sep 16, 2024 · 2 comments
Open

Unknown flag --run-cmd #2025

JonahGroendal opened this issue Sep 16, 2024 · 2 comments

Comments

@JonahGroendal
Copy link

Describe the bug

Docker container no longer starts

Steps to reproduce

  1. docker compose up -d
  2. Look at logs

docker-compose file:
version: "3"
services:
watchtower:
image: containrrr/watchtower
volumes:
- /var/run/docker.sock:/var/run/docker.sock
- ./post_update.sh:/post_update.sh
environment:
- WATCHTOWER_NOTIFICATIONS=sh
- WATCHTOWER_NOTIFICATION_URL=/script.sh
- WATCHTOWER_NOTIFICATION_TEMPLATE={{range .}}{{.Name}}{{end}} # for logs
command: --schedule "0 0 4 * * *" --run-cmd "sh /post_update.sh" --cleanup # update at 5am and run compose restart script
restart: unless-stopped

Expected behavior

Docker container starts with the same Docker-compose file that it has always started with

Screenshots

No response

Environment

Armbian

Your logs

time="2024-09-16T18:07:34Z" level=fatal msg="unknown flag: --run-cmd"
Error: unknown flag: --run-cmd
Usage:
  watchtower [flags]
  watchtower [command]

Available Commands:
  completion     Generate the autocompletion script for the specified shell
  help           Help about any command
  notify-upgrade Upgrade legacy notification configuration to shoutrrr URLs

Flags:
  -a, --api-version string                          api version to use by docker client (default "1.25")
  -c, --cleanup                                     Remove previously used images after updating
  -d, --debug                                       Enable debug mode with verbose logging
  -x, --disable-containers strings                  Comma-separated list of containers to explicitly exclude from watching.
      --enable-lifecycle-hooks                      Enable the execution of commands triggered by pre- and post-update lifecycle hooks
      --health-check                                Do health check and exit
  -h, --help                                        help for watchtower
  -H, --host string                                 daemon socket to connect to (default "unix:///var/run/docker.sock")
      --http-api-metrics                            Runs Watchtower with the Prometheus metrics API enabled
      --http-api-periodic-polls                     Also run periodic updates (specified with --interval and --schedule) if HTTP API is enabled
      --http-api-token string                       Sets an authentication token to HTTP API requests.
      --http-api-update                             Runs Watchtower in HTTP API mode, so that image updates must to be triggered by a request
      --include-restarting                          Will also include restarting containers
  -S, --include-stopped                             Will also include created and exited containers
  -i, --interval int                                Poll interval (in seconds) (default 86400)
  -e, --label-enable                                Watch containers where the com.centurylinklabs.watchtower.enable label is true
      --label-take-precedence                       Label applied to containers take precedence over arguments
  -l, --log-format string                           Sets what logging format to use for console output. Possible values: Auto, LogFmt, Pretty, JSON (default "auto")
      --log-level string                            The maximum log level that will be written to STDERR. Possible values: panic, fatal, error, warn, info, debug or trace (default "info")
  -m, --monitor-only                                Will only monitor for new images, not update the containers
      --no-color                                    Disable ANSI color escape codes in log output
      --no-pull                                     Do not pull any new images
      --no-restart                                  Do not restart any containers
      --no-startup-message                          Prevents watchtower from sending a startup message
      --notification-email-delay int                Delay before sending notifications, expressed in seconds
      --notification-email-from string              Address to send notification emails from
      --notification-email-server string            SMTP server to send notification emails through
      --notification-email-server-password string   SMTP server password for sending notifications
      --notification-email-server-port int          SMTP server port to send notification emails through (default 25)
      --notification-email-server-tls-skip-verify   Controls whether watchtower verifies the SMTP server's certificate chain and host name.
                                                    Should only be used for testing.
      --notification-email-server-user string       SMTP server user for sending notifications
      --notification-email-subjecttag string        Subject prefix tag for notifications via mail
      --notification-email-to string                Address to send notification emails to
      --notification-gotify-tls-skip-verify         Controls whether watchtower verifies the Gotify server's certificate chain and host name.
                                                    Should only be used for testing.
      --notification-gotify-token string            The Gotify Application required to query the Gotify API
      --notification-gotify-url string              The Gotify URL to send notifications to
      --notification-log-stdout                     Write notification logs to stdout instead of logging (to stderr)
      --notification-msteams-data                   The MSTeams notifier will try to extract log entry fields as MSTeams message facts
      --notification-msteams-hook string            The MSTeams WebHook URL to send notifications to
      --notification-report                         Use the session report as the notification template data
      --notification-skip-title                     Do not pass the title param to notifications
      --notification-slack-channel string           A string which overrides the webhook's default channel. Example: #my-custom-channel
      --notification-slack-hook-url string          The Slack Hook URL to send notifications to
      --notification-slack-icon-emoji string        An emoji code string to use in place of the default icon
      --notification-slack-icon-url string          An icon image URL string to use in place of the default icon
      --notification-slack-identifier string        A string which will be used to identify the messages coming from this watchtower instance (default "watchtower")
      --notification-template string                The shoutrrr text/template for the messages (default "{{range .}}{{.Name}}{{end}}")
      --notification-title-tag string               Title prefix tag for notifications
      --notification-url stringArray                The shoutrrr URL to send notifications to (default [/script.sh])
  -n, --notifications strings                        Notification types to send (valid: email, slack, msteams, gotify, shoutrrr) (default [sh])
      --notifications-delay int                     Delay before sending notifications, expressed in seconds
      --notifications-hostname string               Custom hostname for notification titles
      --notifications-level string                  The log level used for sending notifications. Possible values: panic, fatal, error, warn, info or debug (default "info")
  -P, --porcelain string                            Write session results to stdout using a stable versioned format. Supported values: "v1"
      --remove-volumes                              Remove attached volumes before updating
      --revive-stopped                              Will also start stopped containers that were updated, if include-stopped is active
      --rolling-restart                             Restart containers one at a time
  -R, --run-once                                    Run once now and exit
  -s, --schedule string                             The cron expression which defines when to update
      --scope string                                Defines a monitoring scope for the Watchtower instance.
  -t, --stop-timeout duration                       Timeout before a container is forcefully stopped (default 10s)
  -v, --tlsverify                                   use TLS and verify the remote
      --trace                                       Enable trace mode with very verbose logging - caution, exposes credentials
      --warn-on-head-failure string                 When to warn about HEAD pull requests failing. Possible values: always, auto or never

Use "watchtower [command] --help" for more information about a command.

time="2024-09-16T18:08:34Z" level=fatal msg="unknown flag: --run-cmd"

Additional context

was this flag removed from the cli?

Copy link

Hi there! 👋🏼 As you're new to this repo, we'd like to suggest that you read our code of conduct as well as our contribution guidelines. Thanks a bunch for opening your first issue! 🙏

@simskij
Copy link
Member

simskij commented Oct 26, 2024

You are trying to override the watchtower command. However, the entry point is still /watchtower, which is likely why you are seeing this issue.

I don't think we've ever had such a flag in watchtower?

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

No branches or pull requests

2 participants