Watchtower-使运行的容器自动更新

Watchtower-使运行的容器自动更新Watchtower 使用介绍 Watchtower 本身被打包成一个镜像 因此运行它 使所有的都会自动更新 root memoriae 152 dockerrunrmc watchtower hWatchtowera Moreinformat

Watchtower

  • 使用介绍

  • Watchtower 本身被打包成一个镜像,因此运行它,使所有的正在运行的容器都会自动更新
root@memoriae-152:~# docker run --rm containrrr/watchtower -h Watchtower automatically updates running Docker containers whenever a new image is released. More information available at https://github.com/containrrr/watchtower/. Usage: watchtower [flags] 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 --enable-lifecycle-hooks Enable the execution of commands triggered by pre- and post-update lifecycle hooks -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-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 -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-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-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 --notification-url stringArray The shoutrrr URL to send notifications to -n, --notifications strings notification types to send (valid: email, slack, msteams, gotify, shoutrrr) --notifications-level string The log level used for sending notifications. Possible values: panic, fatal, error, warn, info or debug (default "info") --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 

自动清除废旧镜像

# 标签为none的镜像 docker run -d \ --name watchtower \ --restart unless-stopped \ -v /var/run/docker.sock:/var/run/docker.sock \ containrrr/watchtower -c 

选择性自动更新

假设我们只想要更新固定的容器,我们可以把容器名称追加到启动命令后面

docker run -d \ --name watchtower \ --restart unless-stopped \ -v /var/run/docker.sock:/var/run/docker.sock \ containrrr/watchtower -c \ nginx redis #也可以通过变量的方式调用容器名称列表 $(cat ~/.watchtower.list) 

设置自动更新的检查频率

docker run -d \ --name watchtower \ --restart unless-stopped \ -v /var/run/docker.sock:/var/run/docker.sock \ containrrr/watchtower -c \ nginx redis \ --interval 3600 
#如每天凌晨 2 点检查一次更新: docker run -d \ --name watchtower \ --restart unless-stopped \ -v /var/run/docker.sock:/var/run/docker.sock \ containrrr/watchtower -c \ --schedule "0 2 * * * *" 

手动更新

docker run --rm \ -v /var/run/docker.sock:/var/run/docker.sock \ containrrr/watchtower -cR \ user nginx 
版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请联系我们举报,一经查实,本站将立刻删除。

发布者:全栈程序员-站长,转载请注明出处:https://javaforall.net/213225.html原文链接:https://javaforall.net

(0)
上一篇 2026年3月18日 下午6:18
下一篇 2026年3月18日 下午6:18


相关推荐

  • 数据库索引是什么 有什么优缺点

    数据库索引是什么 有什么优缺点数据库索引是什么数据库索引是:数据库索引就像是一本书的目录一样,使用它可以让你在数据库里搜索查询的速度大大提升。而我们使用索引的目的就是,加快表中的查找和排序。索引的几种类型分别是普通索引、唯一索引、聚集索引、主键索引、全文索引几种。使用索引的优点就是:提高数据的搜索速度 加快表与表之间的连接速度 在信息检索过程中,若使用分组及排序子句进行时,通过建立索引能有效的减少检索过程中所…

    2022年5月18日
    66
  • Linux删除软链接

    Linux删除软链接首先我们先来创建一个文件#mkdirtest_chk#touchtest_chk/test.txt#vimtest_chk/test.txt(这一步随便在这个test.txt里写点东东即可)下面我们来创建test_chk上当的软链接#ln-stest_chktest_chk_ln软链接创建好了,我们来看看怎么删除它正确的删除方式(删除软链接,

    2022年6月18日
    43
  • 用户、角色、权限表的关系(mysql)

    用户、角色、权限表的关系(mysql)一,各个表格1、用户表CREATETABLE`t_user`( `id`varchar(40)NOTNULL, `username`varchar(20)NOTNULL, PRIMARYKEY(`id`))2、角色表CREATETABLE`t_role`( `id`int(11)NOT

    2026年4月17日
    6
  • python sched_python定时任务 sched模块用法实例

    python sched_python定时任务 sched模块用法实例这篇文章主要介绍了 python 定时任务 sched 模块用法实例 文中通过示例代码介绍的非常详细 对大家的学习或者工作具有一定的参考学习价值 需要的朋友可以参考下通过 sched 模块可以实现通过自定义时间 自定义函数 自定义优先级来执行函数 schedule sched scheduler time time time sleep schedule 是一个对象 叫什么名字都可以 schedule

    2026年3月18日
    1
  • navicat 15激活码 linux【2021.10最新】

    (navicat 15激活码 linux)这是一篇idea技术相关文章,由全栈君为大家提供,主要知识点是关于2021JetBrains全家桶永久激活码的内容IntelliJ2021最新激活注册码,破解教程可免费永久激活,亲测有效,下面是详细链接哦~https://javaforall.net/100143.html1STL5S9V8F-eyJsaWN…

    2022年3月27日
    74
  • struts中的action_type object has no attribute

    struts中的action_type object has no attribute在Strust2中,有一个内置对象叫ActionContext,通过该对象可以获得之前Servlet中的对象,比如:requst对象,response对象…那么为什么可以通过ActionContext获得那些对象呢?那是因为在ActionContext内容引用了那些对象,也就是在ActionContext内部记录了那些对象的地址,看下图上图就是简单理解为什么通过Action

    2025年10月16日
    4

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注

关注全栈程序员社区公众号