Deployed 0c53b71 with MkDocs version: 1.1.2

gh-pages
3 years ago
parent e84594e7b1
commit e7c07c8ba8

@ -9,7 +9,7 @@
<link rel="canonical" href="http://containrrr.github.io/watchtower/arguments/"> <link rel="canonical" href="https://containrrr.dev/watchtower/arguments/">
<link rel="icon" href="../images/favicon.ico"> <link rel="icon" href="../images/favicon.ico">
<meta name="generator" content="mkdocs-1.1.2, mkdocs-material-7.1.3"> <meta name="generator" content="mkdocs-1.1.2, mkdocs-material-7.1.3">
@ -464,6 +464,13 @@
TLS Verification TLS Verification
</a> </a>
</li>
<li class="md-nav__item">
<a href="#head_failure_warnings" class="md-nav__link">
HEAD failure warnings
</a>
</li> </li>
</ul> </ul>
@ -841,6 +848,13 @@
TLS Verification TLS Verification
</a> </a>
</li>
<li class="md-nav__item">
<a href="#head_failure_warnings" class="md-nav__link">
HEAD failure warnings
</a>
</li> </li>
</ul> </ul>
@ -866,254 +880,240 @@
will be the local Docker daemon, but you can override it with the <code>--host</code> option described in the next section). However, you will be the local Docker daemon, but you can override it with the <code>--host</code> option described in the next section). However, you
can restrict watchtower to monitoring a subset of the running containers by specifying the container names as arguments when can restrict watchtower to monitoring a subset of the running containers by specifying the container names as arguments when
launching watchtower.</p> launching watchtower.</p>
<div class="codehilite"><pre><span></span><code>$ docker run -d <span class="se">\</span> <div class="highlight"><pre><span></span><code>$ docker run -d <span class="se">\</span>
--name watchtower <span class="se">\</span> --name watchtower <span class="se">\</span>
-v /var/run/docker.sock:/var/run/docker.sock <span class="se">\</span> -v /var/run/docker.sock:/var/run/docker.sock <span class="se">\</span>
containrrr/watchtower <span class="se">\</span> containrrr/watchtower <span class="se">\</span>
nginx redis nginx redis
</code></pre></div> </code></pre></div>
<p>In the example above, watchtower will only monitor the containers named "nginx" and "redis" for updates -- all of the other <p>In the example above, watchtower will only monitor the containers named "nginx" and "redis" for updates -- all of the other
running containers will be ignored. If you do not want watchtower to run as a daemon you can pass the <code>--run-once</code> flag and remove running containers will be ignored. If you do not want watchtower to run as a daemon you can pass the <code>--run-once</code> flag and remove
the watchtower container after its execution.</p> the watchtower container after its execution.</p>
<div class="codehilite"><pre><span></span><code>$ docker run --rm <span class="se">\</span> <div class="highlight"><pre><span></span><code>$ docker run --rm <span class="se">\</span>
-v /var/run/docker.sock:/var/run/docker.sock <span class="se">\</span> -v /var/run/docker.sock:/var/run/docker.sock <span class="se">\</span>
containrrr/watchtower <span class="se">\</span> containrrr/watchtower <span class="se">\</span>
--run-once <span class="se">\</span> --run-once <span class="se">\</span>
nginx redis nginx redis
</code></pre></div> </code></pre></div>
<p>In the example above, watchtower will execute an upgrade attempt on the containers named "nginx" and "redis". Using this mode will enable debugging output showing all actions performed, as usage is intended for interactive users. Once the attempt is completed, the container will exit and remove itself due to the <code>--rm</code> flag.</p> <p>In the example above, watchtower will execute an upgrade attempt on the containers named "nginx" and "redis". Using this mode will enable debugging output showing all actions performed, as usage is intended for interactive users. Once the attempt is completed, the container will exit and remove itself due to the <code>--rm</code> flag.</p>
<p>When no arguments are specified, watchtower will monitor all running containers.</p> <p>When no arguments are specified, watchtower will monitor all running containers.</p>
<h2 id="help">Help<a class="headerlink" href="#help" title="Permanent link">&para;</a></h2> <h2 id="help">Help<a class="headerlink" href="#help" title="Permanent link">&para;</a></h2>
<p>Shows documentation about the supported flags.</p> <p>Shows documentation about the supported flags.</p>
<div class="codehilite"><pre><span></span><code> Argument: --help <div class="highlight"><pre><span></span><code> Argument: --help
Environment Variable: N/A Environment Variable: N/A
Type: N/A Type: N/A
Default: N/A Default: N/A
</code></pre></div> </code></pre></div>
<h2 id="time_zone">Time Zone<a class="headerlink" href="#time_zone" title="Permanent link">&para;</a></h2> <h2 id="time_zone">Time Zone<a class="headerlink" href="#time_zone" title="Permanent link">&para;</a></h2>
<p>Sets the time zone to be used by WatchTower's logs and the optional Cron scheduling argument (--schedule). If this environment variable is not set, Watchtower will use the default time zone: UTC. <p>Sets the time zone to be used by WatchTower's logs and the optional Cron scheduling argument (--schedule). If this environment variable is not set, Watchtower will use the default time zone: UTC.
To find out the right value, see <a href="https://en.wikipedia.org/wiki/List_of_tz_database_time_zones">this list</a>, find your location and use the value in <em>TZ Database Name</em>, e.g <em>Europe/Rome</em>. The timezone can alternatively be set by volume mounting your hosts /etc/localtime file. <code>-v /etc/localtime:/etc/localtime:ro</code></p> To find out the right value, see <a href="https://en.wikipedia.org/wiki/List_of_tz_database_time_zones">this list</a>, find your location and use the value in <em>TZ Database Name</em>, e.g <em>Europe/Rome</em>. The timezone can alternatively be set by volume mounting your hosts /etc/localtime file. <code>-v /etc/localtime:/etc/localtime:ro</code></p>
<div class="codehilite"><pre><span></span><code> Argument: N/A <div class="highlight"><pre><span></span><code> Argument: N/A
Environment Variable: TZ Environment Variable: TZ
Type: String Type: String
Default: &quot;UTC&quot; Default: &quot;UTC&quot;
</code></pre></div> </code></pre></div>
<h2 id="cleanup">Cleanup<a class="headerlink" href="#cleanup" title="Permanent link">&para;</a></h2> <h2 id="cleanup">Cleanup<a class="headerlink" href="#cleanup" title="Permanent link">&para;</a></h2>
<p>Removes old images after updating. When this flag is specified, watchtower will remove the old image after restarting a container with a new image. Use this option to prevent the accumulation of orphaned images on your system as containers are updated.</p> <p>Removes old images after updating. When this flag is specified, watchtower will remove the old image after restarting a container with a new image. Use this option to prevent the accumulation of orphaned images on your system as containers are updated.</p>
<div class="codehilite"><pre><span></span><code> Argument: --cleanup <div class="highlight"><pre><span></span><code> Argument: --cleanup
Environment Variable: WATCHTOWER_CLEANUP Environment Variable: WATCHTOWER_CLEANUP
Type: Boolean Type: Boolean
Default: false Default: false
</code></pre></div> </code></pre></div>
<h2 id="remove_attached_volumes">Remove attached volumes<a class="headerlink" href="#remove_attached_volumes" title="Permanent link">&para;</a></h2> <h2 id="remove_attached_volumes">Remove attached volumes<a class="headerlink" href="#remove_attached_volumes" title="Permanent link">&para;</a></h2>
<p>Removes attached volumes after updating. When this flag is specified, watchtower will remove all attached volumes from the container before restarting with a new image. Use this option to force new volumes to be populated as containers are updated.</p> <p>Removes attached volumes after updating. When this flag is specified, watchtower will remove all attached volumes from the container before restarting with a new image. Use this option to force new volumes to be populated as containers are updated.</p>
<div class="codehilite"><pre><span></span><code> Argument: --remove-volumes <div class="highlight"><pre><span></span><code> Argument: --remove-volumes
Environment Variable: WATCHTOWER_REMOVE_VOLUMES Environment Variable: WATCHTOWER_REMOVE_VOLUMES
Type: Boolean Type: Boolean
Default: false Default: false
</code></pre></div> </code></pre></div>
<h2 id="debug">Debug<a class="headerlink" href="#debug" title="Permanent link">&para;</a></h2> <h2 id="debug">Debug<a class="headerlink" href="#debug" title="Permanent link">&para;</a></h2>
<p>Enable debug mode with verbose logging.</p> <p>Enable debug mode with verbose logging.</p>
<div class="codehilite"><pre><span></span><code> Argument: --debug, -d <div class="highlight"><pre><span></span><code> Argument: --debug, -d
Environment Variable: WATCHTOWER_DEBUG Environment Variable: WATCHTOWER_DEBUG
Type: Boolean Type: Boolean
Default: false Default: false
</code></pre></div> </code></pre></div>
<h2 id="trace">Trace<a class="headerlink" href="#trace" title="Permanent link">&para;</a></h2> <h2 id="trace">Trace<a class="headerlink" href="#trace" title="Permanent link">&para;</a></h2>
<p>Enable trace mode with very verbose logging. Caution: exposes credentials!</p> <p>Enable trace mode with very verbose logging. Caution: exposes credentials!</p>
<div class="codehilite"><pre><span></span><code> Argument: --trace <div class="highlight"><pre><span></span><code> Argument: --trace
Environment Variable: WATCHTOWER_TRACE Environment Variable: WATCHTOWER_TRACE
Type: Boolean Type: Boolean
Default: false Default: false
</code></pre></div> </code></pre></div>
<h2 id="ansi_colors">ANSI colors<a class="headerlink" href="#ansi_colors" title="Permanent link">&para;</a></h2> <h2 id="ansi_colors">ANSI colors<a class="headerlink" href="#ansi_colors" title="Permanent link">&para;</a></h2>
<p>Disable ANSI color escape codes in log output.</p> <p>Disable ANSI color escape codes in log output.</p>
<div class="codehilite"><pre><span></span><code> Argument: --no-color <div class="highlight"><pre><span></span><code> Argument: --no-color
Environment Variable: NO_COLOR Environment Variable: NO_COLOR
Type: Boolean Type: Boolean
Default: false Default: false
</code></pre></div> </code></pre></div>
<h2 id="docker_host">Docker host<a class="headerlink" href="#docker_host" title="Permanent link">&para;</a></h2> <h2 id="docker_host">Docker host<a class="headerlink" href="#docker_host" title="Permanent link">&para;</a></h2>
<p>Docker daemon socket to connect to. Can be pointed at a remote Docker host by specifying a TCP endpoint as "tcp://hostname:port".</p> <p>Docker daemon socket to connect to. Can be pointed at a remote Docker host by specifying a TCP endpoint as "tcp://hostname:port".</p>
<div class="codehilite"><pre><span></span><code> <span class="n">Argument</span><span class="p">:</span> <span class="o">--</span><span class="n">host</span><span class="p">,</span> <span class="o">-</span><span class="n">H</span> <div class="highlight"><pre><span></span><code> Argument: --host, -H
<span class="n">Environment</span> <span class="n">Variable</span><span class="p">:</span> <span class="n">DOCKER_HOST</span> Environment Variable: DOCKER_HOST
<span class="n">Type</span><span class="p">:</span> <span class="nb nb-Type">String</span> Type: String
<span class="n">Default</span><span class="p">:</span> <span class="s2">&quot;unix:///var/run/docker.sock&quot;</span> Default: &quot;unix:///var/run/docker.sock&quot;
</code></pre></div> </code></pre></div>
<h2 id="docker_api_version">Docker API version<a class="headerlink" href="#docker_api_version" title="Permanent link">&para;</a></h2> <h2 id="docker_api_version">Docker API version<a class="headerlink" href="#docker_api_version" title="Permanent link">&para;</a></h2>
<p>The API version to use by the Docker client for connecting to the Docker daemon. The minimum supported version is 1.24.</p> <p>The API version to use by the Docker client for connecting to the Docker daemon. The minimum supported version is 1.24.</p>
<div class="codehilite"><pre><span></span><code> Argument: --api-version, -a <div class="highlight"><pre><span></span><code> Argument: --api-version, -a
Environment Variable: DOCKER_API_VERSION Environment Variable: DOCKER_API_VERSION
Type: String Type: String
Default: &quot;1.24&quot; Default: &quot;1.24&quot;
</code></pre></div> </code></pre></div>
<h2 id="include_restarting">Include restarting<a class="headerlink" href="#include_restarting" title="Permanent link">&para;</a></h2> <h2 id="include_restarting">Include restarting<a class="headerlink" href="#include_restarting" title="Permanent link">&para;</a></h2>
<p>Will also include restarting containers.</p> <p>Will also include restarting containers.</p>
<div class="codehilite"><pre><span></span><code> <span class="nv">Argument</span>: <span class="o">--</span><span class="k">include</span><span class="o">-</span><span class="nv">restarting</span> <div class="highlight"><pre><span></span><code> Argument: --include-restarting
<span class="nv">Environment</span> <span class="nv">Variable</span>: <span class="nv">WATCHTOWER_INCLUDE_RESTARTING</span> Environment Variable: WATCHTOWER_INCLUDE_RESTARTING
<span class="nv">Type</span>: <span class="nv">Boolean</span> Type: Boolean
<span class="nv">Default</span>: <span class="nv">false</span> Default: false
</code></pre></div> </code></pre></div>
<h2 id="include_stopped">Include stopped<a class="headerlink" href="#include_stopped" title="Permanent link">&para;</a></h2> <h2 id="include_stopped">Include stopped<a class="headerlink" href="#include_stopped" title="Permanent link">&para;</a></h2>
<p>Will also include created and exited containers.</p> <p>Will also include created and exited containers.</p>
<div class="codehilite"><pre><span></span><code> <span class="nv">Argument</span>: <span class="o">--</span><span class="k">include</span><span class="o">-</span><span class="nv">stopped</span> <div class="highlight"><pre><span></span><code> Argument: --include-stopped
<span class="nv">Environment</span> <span class="nv">Variable</span>: <span class="nv">WATCHTOWER_INCLUDE_STOPPED</span> Environment Variable: WATCHTOWER_INCLUDE_STOPPED
<span class="nv">Type</span>: <span class="nv">Boolean</span> Type: Boolean
<span class="nv">Default</span>: <span class="nv">false</span> Default: false
</code></pre></div> </code></pre></div>
<h2 id="revive_stopped">Revive stopped<a class="headerlink" href="#revive_stopped" title="Permanent link">&para;</a></h2> <h2 id="revive_stopped">Revive stopped<a class="headerlink" href="#revive_stopped" title="Permanent link">&para;</a></h2>
<p>Start any stopped containers that have had their image updated. This argument is only usable with the <code>--include-stopped</code> argument.</p> <p>Start any stopped containers that have had their image updated. This argument is only usable with the <code>--include-stopped</code> argument.</p>
<div class="codehilite"><pre><span></span><code> Argument: --revive-stopped <div class="highlight"><pre><span></span><code> Argument: --revive-stopped
Environment Variable: WATCHTOWER_REVIVE_STOPPED Environment Variable: WATCHTOWER_REVIVE_STOPPED
Type: Boolean Type: Boolean
Default: false Default: false
</code></pre></div> </code></pre></div>
<h2 id="poll_interval">Poll interval<a class="headerlink" href="#poll_interval" title="Permanent link">&para;</a></h2> <h2 id="poll_interval">Poll interval<a class="headerlink" href="#poll_interval" title="Permanent link">&para;</a></h2>
<p>Poll interval (in seconds). This value controls how frequently watchtower will poll for new images. Either <code>--schedule</code> or a poll interval can be defined, but not both.</p> <p>Poll interval (in seconds). This value controls how frequently watchtower will poll for new images. Either <code>--schedule</code> or a poll interval can be defined, but not both.</p>
<div class="codehilite"><pre><span></span><code> Argument: --interval, -i <div class="highlight"><pre><span></span><code> Argument: --interval, -i
Environment Variable: WATCHTOWER_POLL_INTERVAL Environment Variable: WATCHTOWER_POLL_INTERVAL
Type: Integer Type: Integer
Default: 86400 (24 hours) Default: 86400 (24 hours)
</code></pre></div> </code></pre></div>
<h2 id="filter_by_enable_label">Filter by enable label<a class="headerlink" href="#filter_by_enable_label" title="Permanent link">&para;</a></h2> <h2 id="filter_by_enable_label">Filter by enable label<a class="headerlink" href="#filter_by_enable_label" title="Permanent link">&para;</a></h2>
<p>Update containers that have a <code>com.centurylinklabs.watchtower.enable</code> label set to true.</p> <p>Update containers that have a <code>com.centurylinklabs.watchtower.enable</code> label set to true.</p>
<div class="codehilite"><pre><span></span><code> Argument: --label-enable <div class="highlight"><pre><span></span><code> Argument: --label-enable
Environment Variable: WATCHTOWER_LABEL_ENABLE Environment Variable: WATCHTOWER_LABEL_ENABLE
Type: Boolean Type: Boolean
Default: false Default: false
</code></pre></div> </code></pre></div>
<h2 id="filter_by_disable_label">Filter by disable label<a class="headerlink" href="#filter_by_disable_label" title="Permanent link">&para;</a></h2> <h2 id="filter_by_disable_label">Filter by disable label<a class="headerlink" href="#filter_by_disable_label" title="Permanent link">&para;</a></h2>
<p><strong>Do not</strong> update containers that have <code>com.centurylinklabs.watchtower.enable</code> label set to false and no <code>--label-enable</code> argument is passed. Note that only one or the other (targeting by enable label) can be used at the same time to target containers.</p> <p><strong>Do not</strong> update containers that have <code>com.centurylinklabs.watchtower.enable</code> label set to false and
no <code>--label-enable</code> argument is passed. Note that only one or the other (targeting by enable label) can be
used at the same time to target containers.</p>
<h2 id="without_updating_containers">Without updating containers<a class="headerlink" href="#without_updating_containers" title="Permanent link">&para;</a></h2> <h2 id="without_updating_containers">Without updating containers<a class="headerlink" href="#without_updating_containers" title="Permanent link">&para;</a></h2>
<p>Will only monitor for new images, send notifications and invoke the <a href="https://containrrr.dev/watchtower/lifecycle-hooks/">pre-check/post-check hooks</a>, but will <strong>not</strong> update the containers.</p> <p>Will only monitor for new images, send notifications and invoke
<blockquote> the <a href="https://containrrr.dev/watchtower/lifecycle-hooks/">pre-check/post-check hooks</a>, but will <strong>not</strong> update the
<p><strong>⚠️ Please note</strong></p> containers.</p>
<p>Due to Docker API limitations the latest image will still be pulled from the registry.</p> <p>!!! note Due to Docker API limitations the latest image will still be pulled from the registry.<br />
</blockquote> The HEAD digest checks allows watchtower to skip pulling when there are no changes, but to know <em>what</em> has changed it
<div class="codehilite"><pre><span></span><code> Argument: --monitor-only will still do a pull whenever the repository digest doesn't match the local image digest.</p>
<div class="highlight"><pre><span></span><code> Argument: --monitor-only
Environment Variable: WATCHTOWER_MONITOR_ONLY Environment Variable: WATCHTOWER_MONITOR_ONLY
Type: Boolean Type: Boolean
Default: false Default: false
</code></pre></div> </code></pre></div>
<p>Note that monitor-only can also be specified on a per-container basis with the <code>com.centurylinklabs.watchtower.monitor-only</code> label set on those containers.</p> <p>Note that monitor-only can also be specified on a per-container basis with the <code>com.centurylinklabs.watchtower.monitor-only</code> label set on those containers.</p>
<h2 id="without_restarting_containers">Without restarting containers<a class="headerlink" href="#without_restarting_containers" title="Permanent link">&para;</a></h2> <h2 id="without_restarting_containers">Without restarting containers<a class="headerlink" href="#without_restarting_containers" title="Permanent link">&para;</a></h2>
<p>Do not restart containers after updating. This option can be useful when the start of the containers <p>Do not restart containers after updating. This option can be useful when the start of the containers
is managed by an external system such as systemd.</p> is managed by an external system such as systemd.
<div class="codehilite"><pre><span></span><code> Argument: --no-restart <div class="highlight"><pre><span></span><code> Argument: --no-restart
Environment Variable: WATCHTOWER_NO_RESTART Environment Variable: WATCHTOWER_NO_RESTART
Type: Boolean Type: Boolean
Default: false Default: false
</code></pre></div> </code></pre></div></p>
<h2 id="without_pulling_new_images">Without pulling new images<a class="headerlink" href="#without_pulling_new_images" title="Permanent link">&para;</a></h2> <h2 id="without_pulling_new_images">Without pulling new images<a class="headerlink" href="#without_pulling_new_images" title="Permanent link">&para;</a></h2>
<p>Do not pull new images. When this flag is specified, watchtower will not attempt to pull <p>Do not pull new images. When this flag is specified, watchtower will not attempt to pull
new images from the registry. Instead it will only monitor the local image cache for changes. new images from the registry. Instead it will only monitor the local image cache for changes.
Use this option if you are building new images directly on the Docker host without pushing Use this option if you are building new images directly on the Docker host without pushing
them to a registry.</p> them to a registry.</p>
<div class="codehilite"><pre><span></span><code> Argument: --no-pull <div class="highlight"><pre><span></span><code> Argument: --no-pull
Environment Variable: WATCHTOWER_NO_PULL Environment Variable: WATCHTOWER_NO_PULL
Type: Boolean Type: Boolean
Default: false Default: false
</code></pre></div> </code></pre></div>
<h2 id="without_sending_a_startup_message">Without sending a startup message<a class="headerlink" href="#without_sending_a_startup_message" title="Permanent link">&para;</a></h2> <h2 id="without_sending_a_startup_message">Without sending a startup message<a class="headerlink" href="#without_sending_a_startup_message" title="Permanent link">&para;</a></h2>
<p>Do not send a message after watchtower started. Otherwise there will be an info-level notification.</p> <p>Do not send a message after watchtower started. Otherwise there will be an info-level notification.</p>
<div class="codehilite"><pre><span></span><code> Argument: --no-startup-message <div class="highlight"><pre><span></span><code> Argument: --no-startup-message
Environment Variable: WATCHTOWER_NO_STARTUP_MESSAGE Environment Variable: WATCHTOWER_NO_STARTUP_MESSAGE
Type: Boolean Type: Boolean
Default: false Default: false
</code></pre></div> </code></pre></div>
<h2 id="run_once">Run once<a class="headerlink" href="#run_once" title="Permanent link">&para;</a></h2> <h2 id="run_once">Run once<a class="headerlink" href="#run_once" title="Permanent link">&para;</a></h2>
<p>Run an update attempt against a container name list one time immediately and exit.</p> <p>Run an update attempt against a container name list one time immediately and exit.</p>
<div class="codehilite"><pre><span></span><code> Argument: --run-once <div class="highlight"><pre><span></span><code> Argument: --run-once
Environment Variable: WATCHTOWER_RUN_ONCE Environment Variable: WATCHTOWER_RUN_ONCE
Type: Boolean Type: Boolean
Default: false Default: false
</code></pre></div> </code></pre></div>
<h2 id="http_api_mode">HTTP API Mode<a class="headerlink" href="#http_api_mode" title="Permanent link">&para;</a></h2> <h2 id="http_api_mode">HTTP API Mode<a class="headerlink" href="#http_api_mode" title="Permanent link">&para;</a></h2>
<p>Runs Watchtower in HTTP API mode, only allowing image updates to be triggered by an HTTP request. For details see <a href="https://containrrr.github.io/watchtower/http-api-mode">HTTP API</a>.</p> <p>Runs Watchtower in HTTP API mode, only allowing image updates to be triggered by an HTTP request.
<div class="codehilite"><pre><span></span><code> Argument: --http-api-update For details see <a href="https://containrrr.github.io/watchtower/http-api-mode">HTTP API</a>.</p>
<div class="highlight"><pre><span></span><code> Argument: --http-api-update
Environment Variable: WATCHTOWER_HTTP_API Environment Variable: WATCHTOWER_HTTP_API
Type: Boolean Type: Boolean
Default: false Default: false
</code></pre></div> </code></pre></div>
<h2 id="http_api_token">HTTP API Token<a class="headerlink" href="#http_api_token" title="Permanent link">&para;</a></h2> <h2 id="http_api_token">HTTP API Token<a class="headerlink" href="#http_api_token" title="Permanent link">&para;</a></h2>
<p>Sets an authentication token to HTTP API requests.</p> <p>Sets an authentication token to HTTP API requests.</p>
<div class="codehilite"><pre><span></span><code> Argument: --http-api-token <div class="highlight"><pre><span></span><code> Argument: --http-api-token
Environment Variable: WATCHTOWER_HTTP_API_TOKEN Environment Variable: WATCHTOWER_HTTP_API_TOKEN
Type: String Type: String
Default: - Default: -
</code></pre></div> </code></pre></div>
<h2 id="filter_by_scope">Filter by scope<a class="headerlink" href="#filter_by_scope" title="Permanent link">&para;</a></h2> <h2 id="filter_by_scope">Filter by scope<a class="headerlink" href="#filter_by_scope" title="Permanent link">&para;</a></h2>
<p>Update containers that have a <code>com.centurylinklabs.watchtower.scope</code> label set with the same value as the given argument. This enables <a href="https://containrrr.github.io/watchtower/running-multiple-instances">running multiple instances</a>.</p> <p>Update containers that have a <code>com.centurylinklabs.watchtower.scope</code> label set with the same value as the given argument.
<div class="codehilite"><pre><span></span><code> Argument: --scope This enables <a href="https://containrrr.github.io/watchtower/running-multiple-instances">running multiple instances</a>.</p>
<div class="highlight"><pre><span></span><code> Argument: --scope
Environment Variable: WATCHTOWER_SCOPE Environment Variable: WATCHTOWER_SCOPE
Type: String Type: String
Default: - Default: -
</code></pre></div> </code></pre></div>
<h2 id="http_api_metrics">HTTP API Metrics<a class="headerlink" href="#http_api_metrics" title="Permanent link">&para;</a></h2> <h2 id="http_api_metrics">HTTP API Metrics<a class="headerlink" href="#http_api_metrics" title="Permanent link">&para;</a></h2>
<p>Enables a metrics endpoint, exposing prometheus metrics via HTTP. See <a href="../metrics/">Metrics</a> for details. </p> <p>Enables a metrics endpoint, exposing prometheus metrics via HTTP. See <a href="../metrics/">Metrics</a> for details. </p>
<div class="codehilite"><pre><span></span><code> Argument: --http-api-metrics <div class="highlight"><pre><span></span><code> Argument: --http-api-metrics
Environment Variable: WATCHTOWER_HTTP_API_METRICS Environment Variable: WATCHTOWER_HTTP_API_METRICS
Type: Boolean Type: Boolean
Default: false Default: false
</code></pre></div> </code></pre></div>
<h2 id="scheduling">Scheduling<a class="headerlink" href="#scheduling" title="Permanent link">&para;</a></h2> <h2 id="scheduling">Scheduling<a class="headerlink" href="#scheduling" title="Permanent link">&para;</a></h2>
<p><a href="https://pkg.go.dev/github.com/robfig/cron@v1.2.0?tab=doc#hdr-CRON_Expression_Format">Cron expression</a> in 6 fields (rather than the traditional 5) which defines when and how often to check for new images. Either <code>--interval</code> or the schedule expression <p><a href="https://pkg.go.dev/github.com/robfig/cron@v1.2.0?tab=doc#hdr-CRON_Expression_Format">Cron expression</a> in 6 fields (rather than the traditional 5) which defines when and how often to check for new images. Either <code>--interval</code> or the schedule expression
can be defined, but not both. An example: <code>--schedule "0 0 4 * * *"</code></p> can be defined, but not both. An example: <code>--schedule "0 0 4 * * *"</code></p>
<div class="codehilite"><pre><span></span><code> Argument: --schedule, -s <div class="highlight"><pre><span></span><code> Argument: --schedule, -s
Environment Variable: WATCHTOWER_SCHEDULE Environment Variable: WATCHTOWER_SCHEDULE
Type: String Type: String
Default: - Default: -
</code></pre></div> </code></pre></div>
<h2 id="rolling_restart">Rolling restart<a class="headerlink" href="#rolling_restart" title="Permanent link">&para;</a></h2> <h2 id="rolling_restart">Rolling restart<a class="headerlink" href="#rolling_restart" title="Permanent link">&para;</a></h2>
<p>Restart one image at time instead of stopping and starting all at once. Useful in conjunction with lifecycle hooks <p>Restart one image at time instead of stopping and starting all at once. Useful in conjunction with lifecycle hooks
to implement zero-downtime deploy.</p> to implement zero-downtime deploy.</p>
<div class="codehilite"><pre><span></span><code> Argument: --rolling-restart <div class="highlight"><pre><span></span><code> Argument: --rolling-restart
Environment Variable: WATCHTOWER_ROLLING_RESTART Environment Variable: WATCHTOWER_ROLLING_RESTART
Type: Boolean Type: Boolean
Default: false Default: false
</code></pre></div> </code></pre></div>
<h2 id="wait_until_timeout">Wait until timeout<a class="headerlink" href="#wait_until_timeout" title="Permanent link">&para;</a></h2> <h2 id="wait_until_timeout">Wait until timeout<a class="headerlink" href="#wait_until_timeout" title="Permanent link">&para;</a></h2>
<p>Timeout before the container is forcefully stopped. When set, this option will change the default (<code>10s</code>) wait time to the given value. An example: <code>--stop-timeout 30s</code> will set the timeout to 30 seconds.</p> <p>Timeout before the container is forcefully stopped. When set, this option will change the default (<code>10s</code>) wait time to the given value. An example: <code>--stop-timeout 30s</code> will set the timeout to 30 seconds.</p>
<div class="codehilite"><pre><span></span><code> Argument: --stop-timeout <div class="highlight"><pre><span></span><code> Argument: --stop-timeout
Environment Variable: WATCHTOWER_TIMEOUT Environment Variable: WATCHTOWER_TIMEOUT
Type: Duration Type: Duration
Default: 10s Default: 10s
</code></pre></div> </code></pre></div>
<h2 id="tls_verification">TLS Verification<a class="headerlink" href="#tls_verification" title="Permanent link">&para;</a></h2> <h2 id="tls_verification">TLS Verification<a class="headerlink" href="#tls_verification" title="Permanent link">&para;</a></h2>
<p>Use TLS when connecting to the Docker socket and verify the server's certificate. See below for options used to configure notifications.</p> <p>Use TLS when connecting to the Docker socket and verify the server's certificate. See below for options used to
<div class="codehilite"><pre><span></span><code> Argument: --tlsverify configure notifications.</p>
<div class="highlight"><pre><span></span><code> Argument: --tlsverify
Environment Variable: DOCKER_TLS_VERIFY Environment Variable: DOCKER_TLS_VERIFY
Type: Boolean Type: Boolean
Default: false Default: false
</code></pre></div> </code></pre></div>
<h2 id="head_failure_warnings">HEAD failure warnings<a class="headerlink" href="#head_failure_warnings" title="Permanent link">&para;</a></h2>
<p>When to warn about HEAD pull requests failing. Auto means that it will warn when the registry is known to handle the
requests and may rate limit pull requests (mainly docker.io).</p>
<div class="highlight"><pre><span></span><code> Argument: --warn-on-head-failure
Environment Variable: WATCHTOWER_WARN_ON_HEAD_FAILURE
Possible values: always, auto, never
Default: auto
</code></pre></div>

@ -9,7 +9,7 @@
<link rel="canonical" href="http://containrrr.github.io/watchtower/container-selection/"> <link rel="canonical" href="https://containrrr.dev/watchtower/container-selection/">
<link rel="icon" href="../images/favicon.ico"> <link rel="icon" href="../images/favicon.ico">
<meta name="generator" content="mkdocs-1.1.2, mkdocs-material-7.1.3"> <meta name="generator" content="mkdocs-1.1.2, mkdocs-material-7.1.3">
@ -506,21 +506,17 @@
</ul> </ul>
<h2 id="full_exclude">Full Exclude<a class="headerlink" href="#full_exclude" title="Permanent link">&para;</a></h2> <h2 id="full_exclude">Full Exclude<a class="headerlink" href="#full_exclude" title="Permanent link">&para;</a></h2>
<p>If you need to exclude some containers, set the <em>com.centurylinklabs.watchtower.enable</em> label to <code>false</code>.</p> <p>If you need to exclude some containers, set the <em>com.centurylinklabs.watchtower.enable</em> label to <code>false</code>.</p>
<div class="codehilite"><pre><span></span><code><span class="k">LABEL</span> com.centurylinklabs.watchtower.enable<span class="o">=</span><span class="s2">&quot;false&quot;</span> <div class="highlight"><pre><span></span><code><span class="k">LABEL</span> com.centurylinklabs.watchtower.enable<span class="o">=</span><span class="s2">&quot;false&quot;</span>
</code></pre></div> </code></pre></div>
<p>Or, it can be specified as part of the <code>docker run</code> command line:</p> <p>Or, it can be specified as part of the <code>docker run</code> command line:</p>
<div class="codehilite"><pre><span></span><code>docker run -d --label<span class="o">=</span>com.centurylinklabs.watchtower.enable<span class="o">=</span><span class="nb">false</span> someimage <div class="highlight"><pre><span></span><code>docker run -d --label<span class="o">=</span>com.centurylinklabs.watchtower.enable<span class="o">=</span><span class="nb">false</span> someimage
</code></pre></div> </code></pre></div>
<p>If you need to <a href="https://containrrr.github.io/watchtower/arguments/#filter_by_enable_label">include only containers with the enable label</a>, pass the <code>--label-enable</code> flag or the <code>WATCHTOWER_LABEL_ENABLE</code> environment variable on startup and set the <em>com.centurylinklabs.watchtower.enable</em> label with a value of <code>true</code> for the containers you want to watch.</p> <p>If you need to <a href="https://containrrr.github.io/watchtower/arguments/#filter_by_enable_label">include only containers with the enable label</a>, pass the <code>--label-enable</code> flag or the <code>WATCHTOWER_LABEL_ENABLE</code> environment variable on startup and set the <em>com.centurylinklabs.watchtower.enable</em> label with a value of <code>true</code> for the containers you want to watch.</p>
<div class="codehilite"><pre><span></span><code><span class="k">LABEL</span> com.centurylinklabs.watchtower.enable<span class="o">=</span><span class="s2">&quot;true&quot;</span> <div class="highlight"><pre><span></span><code><span class="k">LABEL</span> com.centurylinklabs.watchtower.enable<span class="o">=</span><span class="s2">&quot;true&quot;</span>
</code></pre></div> </code></pre></div>
<p>Or, it can be specified as part of the <code>docker run</code> command line:</p> <p>Or, it can be specified as part of the <code>docker run</code> command line:</p>
<div class="codehilite"><pre><span></span><code>docker run -d --label<span class="o">=</span>com.centurylinklabs.watchtower.enable<span class="o">=</span><span class="nb">true</span> someimage <div class="highlight"><pre><span></span><code>docker run -d --label<span class="o">=</span>com.centurylinklabs.watchtower.enable<span class="o">=</span><span class="nb">true</span> someimage
</code></pre></div> </code></pre></div>
<p>If you wish to create a monitoring scope, you will need to <a href="https://containrrr.github.io/watchtower/running-multiple-instances">run multiple instances and set a scope for each of them</a>.</p> <p>If you wish to create a monitoring scope, you will need to <a href="https://containrrr.github.io/watchtower/running-multiple-instances">run multiple instances and set a scope for each of them</a>.</p>
<p>Watchtower filters running containers by testing them against each configured criteria. A container is monitored if all criteria are met. For example: <p>Watchtower filters running containers by testing them against each configured criteria. A container is monitored if all criteria are met. For example:
- If a container's name is on the monitoring name list (not empty <code>--name</code> argument) but it is not enabled (<em>centurylinklabs.watchtower.enable=false</em>), it won't be monitored; - If a container's name is on the monitoring name list (not empty <code>--name</code> argument) but it is not enabled (<em>centurylinklabs.watchtower.enable=false</em>), it won't be monitored;
@ -528,13 +524,11 @@
<h2 id="monitor_only">Monitor Only<a class="headerlink" href="#monitor_only" title="Permanent link">&para;</a></h2> <h2 id="monitor_only">Monitor Only<a class="headerlink" href="#monitor_only" title="Permanent link">&para;</a></h2>
<p>Individual containers can be marked to only be monitored (without being updated).</p> <p>Individual containers can be marked to only be monitored (without being updated).</p>
<p>To do so, set the <em>com.centurylinklabs.watchtower.monitor-only</em> label to <code>true</code> on that container.</p> <p>To do so, set the <em>com.centurylinklabs.watchtower.monitor-only</em> label to <code>true</code> on that container.</p>
<div class="codehilite"><pre><span></span><code><span class="k">LABEL</span> com.centurylinklabs.watchtower.monitor-only<span class="o">=</span><span class="s2">&quot;true&quot;</span> <div class="highlight"><pre><span></span><code><span class="k">LABEL</span> com.centurylinklabs.watchtower.monitor-only<span class="o">=</span><span class="s2">&quot;true&quot;</span>
</code></pre></div> </code></pre></div>
<p>Or, it can be specified as part of the <code>docker run</code> command line:</p> <p>Or, it can be specified as part of the <code>docker run</code> command line:</p>
<div class="codehilite"><pre><span></span><code>docker run -d --label<span class="o">=</span>com.centurylinklabs.watchtower.monitor-only<span class="o">=</span><span class="nb">true</span> someimage <div class="highlight"><pre><span></span><code>docker run -d --label<span class="o">=</span>com.centurylinklabs.watchtower.monitor-only<span class="o">=</span><span class="nb">true</span> someimage
</code></pre></div> </code></pre></div>
<p>When the label is specified on a container, watchtower treats that container exactly as if <a href="https://containrrr.dev/watchtower/arguments/#without_updating_containers"><code>WATCHTOWER_MONITOR_ONLY</code></a> was set, but the effect is limited to the individual container. </p> <p>When the label is specified on a container, watchtower treats that container exactly as if <a href="https://containrrr.dev/watchtower/arguments/#without_updating_containers"><code>WATCHTOWER_MONITOR_ONLY</code></a> was set, but the effect is limited to the individual container. </p>

@ -9,7 +9,7 @@
<link rel="canonical" href="http://containrrr.github.io/watchtower/http-api-mode/"> <link rel="canonical" href="https://containrrr.dev/watchtower/http-api-mode/">
<link rel="icon" href="../images/favicon.ico"> <link rel="icon" href="../images/favicon.ico">
<meta name="generator" content="mkdocs-1.1.2, mkdocs-material-7.1.3"> <meta name="generator" content="mkdocs-1.1.2, mkdocs-material-7.1.3">
@ -419,7 +419,7 @@
</ul> </ul>
<hr /> <hr />
<p>To enable this mode, use the flag <code>--http-api-update</code>. For example, in a Docker Compose config file:</p> <p>To enable this mode, use the flag <code>--http-api-update</code>. For example, in a Docker Compose config file:</p>
<div class="codehilite"><pre><span></span><code><span class="nt">version</span><span class="p">:</span> <span class="s">&#39;3&#39;</span> <div class="highlight"><pre><span></span><code><span class="nt">version</span><span class="p">:</span> <span class="s">&#39;3&#39;</span>
<span class="nt">services</span><span class="p">:</span> <span class="nt">services</span><span class="p">:</span>
<span class="nt">app-monitored-by-watchtower</span><span class="p">:</span> <span class="nt">app-monitored-by-watchtower</span><span class="p">:</span>
@ -439,9 +439,8 @@
<span class="nt">ports</span><span class="p">:</span> <span class="nt">ports</span><span class="p">:</span>
<span class="p p-Indicator">-</span> <span class="l l-Scalar l-Scalar-Plain">8080:8080</span> <span class="p p-Indicator">-</span> <span class="l l-Scalar l-Scalar-Plain">8080:8080</span>
</code></pre></div> </code></pre></div>
<p>Notice that there is an environment variable named WATCHTOWER_HTTP_API_TOKEN. To prevent external services from accidentally triggering image updates, all of the requests have to contain a "Token" field, valued as the token defined in WATCHTOWER_HTTP_API_TOKEN, in their headers. In this case, there is a port bind to the host machine, allowing to request localhost:8080 to reach Watchtower. The following <code>curl</code> command would trigger an image update:</p> <p>Notice that there is an environment variable named WATCHTOWER_HTTP_API_TOKEN. To prevent external services from accidentally triggering image updates, all of the requests have to contain a "Token" field, valued as the token defined in WATCHTOWER_HTTP_API_TOKEN, in their headers. In this case, there is a port bind to the host machine, allowing to request localhost:8080 to reach Watchtower. The following <code>curl</code> command would trigger an image update:</p>
<div class="codehilite"><pre><span></span><code>curl -H <span class="s2">&quot;Authorization: Bearer mytoken&quot;</span> localhost:8080/v1/update <div class="highlight"><pre><span></span><code>curl -H <span class="s2">&quot;Authorization: Bearer mytoken&quot;</span> localhost:8080/v1/update
</code></pre></div> </code></pre></div>

@ -9,7 +9,7 @@
<link rel="canonical" href="http://containrrr.github.io/watchtower/"> <link rel="canonical" href="https://containrrr.dev/watchtower/">
<link rel="icon" href="images/favicon.ico"> <link rel="icon" href="images/favicon.ico">
<meta name="generator" content="mkdocs-1.1.2, mkdocs-material-7.1.3"> <meta name="generator" content="mkdocs-1.1.2, mkdocs-material-7.1.3">
@ -496,7 +496,7 @@
<img alt="Circle CI" src="https://circleci.com/gh/containrrr/watchtower.svg?style=shield" /> <img alt="Circle CI" src="https://circleci.com/gh/containrrr/watchtower.svg?style=shield" />
</a> </a>
<a href="https://codecov.io/gh/containrrr/watchtower"> <a href="https://codecov.io/gh/containrrr/watchtower">
<img alt="Codecov" src="https://codecov.io/gh/containrrr/watchtower/branch/master/graph/badge.svg?token=8pxWgB380Y"> <img alt="Codecov" src="https://codecov.io/gh/containrrr/watchtower/branch/main/graph/badge.svg">
</a> </a>
<a href="https://godoc.org/github.com/containrrr/watchtower"> <a href="https://godoc.org/github.com/containrrr/watchtower">
<img alt="GoDoc" src="https://godoc.org/github.com/containrrr/watchtower?status.svg" /> <img alt="GoDoc" src="https://godoc.org/github.com/containrrr/watchtower?status.svg" />
@ -525,12 +525,23 @@
</p> </p>
<h2 id="quick_start">Quick Start<a class="headerlink" href="#quick_start" title="Permanent link">&para;</a></h2> <h2 id="quick_start">Quick Start<a class="headerlink" href="#quick_start" title="Permanent link">&para;</a></h2>
<p>With watchtower you can update the running version of your containerized app simply by pushing a new image to the Docker Hub or your own image registry. Watchtower will pull down your new image, gracefully shut down your existing container and restart it with the same options that were used when it was deployed initially. Run the watchtower container with the following command:</p> <p>With watchtower you can update the running version of your containerized app simply by pushing a new image to the Docker
<div class="codehilite"><pre><span></span><code>$ docker run -d <span class="se">\</span> Hub or your own image registry. Watchtower will pull down your new image, gracefully shut down your existing container
--name watchtower <span class="se">\</span> and restart it with the same options that were used when it was deployed initially. Run the watchtower container with
-v /var/run/docker.sock:/var/run/docker.sock <span class="se">\</span> the following command:</p>
containrrr/watchtower <div class="tabbed-set" data-tabs="1:1"><input checked="checked" id="__tabbed_1_1" name="__tabbed_1" type="radio" /><label for="__tabbed_1_1">docker run</label><div class="tabbed-content"></div>
</code></pre></div> </div>
<p>```bash $ docker run -d \
--name watchtower \
-v /var/run/docker.sock:/var/run/docker.sock \
containrrr/watchtower
<div class="highlight"><pre><span></span><code>=== &quot;docker-compose.yml&quot;
```yaml version: &quot;3&quot;
services:
watchtower:
image: containrrr/watchtower volumes:
- /var/run/docker.sock:/var/run/docker.sock
</code></pre></div></p>

@ -9,7 +9,7 @@
<link rel="canonical" href="http://containrrr.github.io/watchtower/introduction/"> <link rel="canonical" href="https://containrrr.dev/watchtower/introduction/">
<link rel="icon" href="../images/favicon.ico"> <link rel="icon" href="../images/favicon.ico">
<meta name="generator" content="mkdocs-1.1.2, mkdocs-material-7.1.3"> <meta name="generator" content="mkdocs-1.1.2, mkdocs-material-7.1.3">
@ -424,12 +424,11 @@
<p>Watchtower is an application that will monitor your running Docker containers and watch for changes to the images that those containers were originally started from. If watchtower detects that an image has changed, it will automatically restart the container using the new image.</p> <p>Watchtower is an application that will monitor your running Docker containers and watch for changes to the images that those containers were originally started from. If watchtower detects that an image has changed, it will automatically restart the container using the new image.</p>
<p>With watchtower you can update the running version of your containerized app simply by pushing a new image to the Docker Hub or your own image registry. Watchtower will pull down your new image, gracefully shut down your existing container and restart it with the same options that were used when it was deployed initially.</p> <p>With watchtower you can update the running version of your containerized app simply by pushing a new image to the Docker Hub or your own image registry. Watchtower will pull down your new image, gracefully shut down your existing container and restart it with the same options that were used when it was deployed initially.</p>
<p>For example, let's say you were running watchtower along with an instance of <em>centurylink/wetty-cli</em> image:</p> <p>For example, let's say you were running watchtower along with an instance of <em>centurylink/wetty-cli</em> image:</p>
<div class="codehilite"><pre><span></span><code>$ docker ps <div class="highlight"><pre><span></span><code>$ docker ps
CONTAINER ID IMAGE STATUS PORTS NAMES CONTAINER ID IMAGE STATUS PORTS NAMES
967848166a45 centurylink/wetty-cli Up <span class="m">10</span> minutes <span class="m">0</span>.0.0.0:8080-&gt;3000/tcp wetty 967848166a45 centurylink/wetty-cli Up 10 minutes 0.0.0.0:8080-&gt;3000/tcp wetty
6cc4d2a9d1a5 containrrr/watchtower Up <span class="m">15</span> minutes watchtower 6cc4d2a9d1a5 containrrr/watchtower Up 15 minutes watchtower
</code></pre></div> </code></pre></div>
<p>Every few minutes watchtower will pull the latest <em>centurylink/wetty-cli</em> image and compare it to the one that was used to run the "wetty" container. If it sees that the image has changed it will stop/remove the "wetty" container and then restart it using the new image and the same <code>docker run</code> options that were used to start the container initially (in this case, that would include the <code>-p 8080:3000</code> port mapping).</p> <p>Every few minutes watchtower will pull the latest <em>centurylink/wetty-cli</em> image and compare it to the one that was used to run the "wetty" container. If it sees that the image has changed it will stop/remove the "wetty" container and then restart it using the new image and the same <code>docker run</code> options that were used to start the container initially (in this case, that would include the <code>-p 8080:3000</code> port mapping).</p>

@ -9,7 +9,7 @@
<link rel="canonical" href="http://containrrr.github.io/watchtower/lifecycle-hooks/"> <link rel="canonical" href="https://containrrr.dev/watchtower/lifecycle-hooks/">
<link rel="icon" href="../images/favicon.ico"> <link rel="icon" href="../images/favicon.ico">
<meta name="generator" content="mkdocs-1.1.2, mkdocs-material-7.1.3"> <meta name="generator" content="mkdocs-1.1.2, mkdocs-material-7.1.3">
@ -565,10 +565,11 @@
<h1>Lifecycle hooks</h1> <h1>Lifecycle hooks</h1>
<h2 id="executing_commands_before_and_after_updating">Executing commands before and after updating<a class="headerlink" href="#executing_commands_before_and_after_updating" title="Permanent link">&para;</a></h2> <h2 id="executing_commands_before_and_after_updating">Executing commands before and after updating<a class="headerlink" href="#executing_commands_before_and_after_updating" title="Permanent link">&para;</a></h2>
<blockquote> <div class="admonition note">
<p><strong>DO NOTE</strong>: These are shell commands executed with <code>sh</code>, and therefore require the <p class="admonition-title">Note</p>
container to provide the <code>sh</code> executable.</p> <p>These are shell commands executed with <code>sh</code>, and therefore require the container to provide the <code>sh</code>
</blockquote> executable.</p>
</div>
<p>It is possible to execute <em>pre/post-check</em> and <em>pre/post-update</em> commands <p>It is possible to execute <em>pre/post-check</em> and <em>pre/post-update</em> commands
<strong>inside</strong> every container updated by watchtower.</p> <strong>inside</strong> every container updated by watchtower.</p>
<ul> <ul>
@ -608,22 +609,21 @@ container to provide the <code>sh</code> executable.</p>
</tr> </tr>
</tbody> </tbody>
</table> </table>
<p>These labels can be declared as instructions in a Dockerfile (with some example .sh files):</p> <p>These labels can be declared as instructions in a Dockerfile (with some example .sh files) or be specified as part of
<div class="codehilite"><pre><span></span><code><span class="k">LABEL</span> com.centurylinklabs.watchtower.lifecycle.pre-check<span class="o">=</span><span class="s2">&quot;/sync.sh&quot;</span> the <code>docker run</code> command line:</p>
<span class="k">LABEL</span> com.centurylinklabs.watchtower.lifecycle.pre-update<span class="o">=</span><span class="s2">&quot;/dump-data.sh&quot;</span> <div class="tabbed-set" data-tabs="1:1"><input checked="checked" id="__tabbed_1_1" name="__tabbed_1" type="radio" /><label for="__tabbed_1_1">Dockerfile</label><div class="tabbed-content"></div>
<span class="k">LABEL</span> com.centurylinklabs.watchtower.lifecycle.post-update<span class="o">=</span><span class="s2">&quot;/restore-data.sh&quot;</span> </div>
<span class="k">LABEL</span> com.centurylinklabs.watchtower.lifecycle.post-check<span class="o">=</span><span class="s2">&quot;/send-heartbeat.sh&quot;</span> <p>```docker LABEL com.centurylinklabs.watchtower.lifecycle.pre-check="/sync.sh"
</code></pre></div> LABEL com.centurylinklabs.watchtower.lifecycle.pre-update="/dump-data.sh"
LABEL com.centurylinklabs.watchtower.lifecycle.post-update="/restore-data.sh"
<p>Or be specified as part of the <code>docker run</code> command line:</p> LABEL com.centurylinklabs.watchtower.lifecycle.post-check="/send-heartbeat.sh"
<div class="codehilite"><pre><span></span><code>docker run -d <span class="se">\</span> <div class="highlight"><pre><span></span><code>=== &quot;docker run&quot;
--label<span class="o">=</span>com.centurylinklabs.watchtower.lifecycle.pre-check<span class="o">=</span><span class="s2">&quot;/sync.sh&quot;</span> <span class="se">\</span> ```bash docker run -d \
--label<span class="o">=</span>com.centurylinklabs.watchtower.lifecycle.pre-update<span class="o">=</span><span class="s2">&quot;/dump-data.sh&quot;</span> <span class="se">\</span> --label=com.centurylinklabs.watchtower.lifecycle.pre-check=&quot;/sync.sh&quot; \
--label<span class="o">=</span>com.centurylinklabs.watchtower.lifecycle.post-update<span class="o">=</span><span class="s2">&quot;/restore-data.sh&quot;</span> <span class="se">\</span> --label=com.centurylinklabs.watchtower.lifecycle.pre-update=&quot;/dump-data.sh&quot; \
someimage --label=com.centurylinklabs.watchtower.lifecycle.post-update=&quot;/restore-data.sh&quot; \
--label<span class="o">=</span>com.centurylinklabs.watchtower.lifecycle.post-check<span class="o">=</span><span class="s2">&quot;/send-heartbeat.sh&quot;</span> <span class="se">\</span> someimage --label=com.centurylinklabs.watchtower.lifecycle.post-check=&quot;/send-heartbeat.sh&quot; \
</code></pre></div> </code></pre></div></p>
<h3 id="timeouts">Timeouts<a class="headerlink" href="#timeouts" title="Permanent link">&para;</a></h3> <h3 id="timeouts">Timeouts<a class="headerlink" href="#timeouts" title="Permanent link">&para;</a></h3>
<p>The timeout for all lifecycle commands is 60 seconds. After that, a timeout will <p>The timeout for all lifecycle commands is 60 seconds. After that, a timeout will
occur, forcing Watchtower to continue the update loop.</p> occur, forcing Watchtower to continue the update loop.</p>

@ -9,7 +9,7 @@
<link rel="canonical" href="http://containrrr.github.io/watchtower/linked-containers/"> <link rel="canonical" href="https://containrrr.dev/watchtower/linked-containers/">
<link rel="icon" href="../images/favicon.ico"> <link rel="icon" href="../images/favicon.ico">
<meta name="generator" content="mkdocs-1.1.2, mkdocs-material-7.1.3"> <meta name="generator" content="mkdocs-1.1.2, mkdocs-material-7.1.3">

@ -9,7 +9,7 @@
<link rel="canonical" href="http://containrrr.github.io/watchtower/metrics/"> <link rel="canonical" href="https://containrrr.dev/watchtower/metrics/">
<link rel="icon" href="../images/favicon.ico"> <link rel="icon" href="../images/favicon.ico">
<meta name="generator" content="mkdocs-1.1.2, mkdocs-material-7.1.3"> <meta name="generator" content="mkdocs-1.1.2, mkdocs-material-7.1.3">
@ -498,11 +498,11 @@
<h1>Metrics</h1> <h1>Metrics</h1>
<blockquote> <div class="admonition warning">
<p><strong>⚠️ Experimental feature</strong></p> <p class="admonition-title">Experimental feature</p>
<p>This feature was added in v1.0.4 and is still considered experimental. <p>This feature was added in v1.0.4 and is still considered experimental. If you notice any strange behavior, please raise
If you notice any strange behavior, please raise a ticket in the repository issues.</p> a ticket in the repository issues.</p>
</blockquote> </div>
<p>Metrics can be used to track how Watchtower behaves over time.</p> <p>Metrics can be used to track how Watchtower behaves over time.</p>
<p>To use this feature, you have to set an <a href="../arguments/#http-api-token">API token</a> and <a href="../arguments/#http-api-metrics">enable the metrics API</a>, <p>To use this feature, you have to set an <a href="../arguments/#http-api-token">API token</a> and <a href="../arguments/#http-api-metrics">enable the metrics API</a>,
as well as creating a port mapping for your container for port <code>8080</code>.</p> as well as creating a port mapping for your container for port <code>8080</code>.</p>

@ -9,7 +9,7 @@
<link rel="canonical" href="http://containrrr.github.io/watchtower/notifications/"> <link rel="canonical" href="https://containrrr.dev/watchtower/notifications/">
<link rel="icon" href="../images/favicon.ico"> <link rel="icon" href="../images/favicon.ico">
<meta name="generator" content="mkdocs-1.1.2, mkdocs-material-7.1.3"> <meta name="generator" content="mkdocs-1.1.2, mkdocs-material-7.1.3">
@ -585,8 +585,10 @@
<h1 id="notifications">Notifications<a class="headerlink" href="#notifications" title="Permanent link">&para;</a></h1> <h1 id="notifications">Notifications<a class="headerlink" href="#notifications" title="Permanent link">&para;</a></h1>
<p>Watchtower can send notifications when containers are updated. Notifications are sent via hooks in the logging system, <a href="http://github.com/sirupsen/logrus">logrus</a>. <p>Watchtower can send notifications when containers are updated. Notifications are sent via hooks in the logging
The types of notifications to send are set by passing a comma-separated list of values to the <code>--notifications</code> option (or corresponding environment variable <code>WATCHTOWER_NOTIFICATIONS</code>), which has the following valid values:</p> system, <a href="http://github.com/sirupsen/logrus">logrus</a>. The types of notifications to send are set by passing a
comma-separated list of values to the <code>--notifications</code> option
(or corresponding environment variable <code>WATCHTOWER_NOTIFICATIONS</code>), which has the following valid values:</p>
<ul> <ul>
<li><code>email</code> to send notifications via e-mail</li> <li><code>email</code> to send notifications via e-mail</li>
<li><code>slack</code> to send notifications through a Slack webhook</li> <li><code>slack</code> to send notifications through a Slack webhook</li>
@ -594,11 +596,17 @@ The types of notifications to send are set by passing a comma-separated list of
<li><code>gotify</code> to send notifications via Gotify</li> <li><code>gotify</code> to send notifications via Gotify</li>
<li><code>shoutrrr</code> to send notifications via <a href="https://github.com/containrrr/shoutrrr">containrrr/shoutrrr</a></li> <li><code>shoutrrr</code> to send notifications via <a href="https://github.com/containrrr/shoutrrr">containrrr/shoutrrr</a></li>
</ul> </ul>
<blockquote> <div class="admonition note">
<p>There is currently a <a href="https://github.com/spf13/viper/issues/380">bug</a> in Viper, which prevents comma-separated slices to be used when using the environment variable. A workaround is available where we instead put quotes around the environment variable value and replace the commas with spaces, as <code>WATCHTOWER_NOTIFICATIONS="slack msteams"</code></p> <p class="admonition-title">Using multiple notifications with environment variables</p>
<p>If you're a <code>docker-compose</code> user, make sure to specify environment variables' values in your <code>.yml</code> file without double quotes (<code>"</code>).</p> <p>There is currently a bug in Viper (<a class="magiclink magiclink-github magiclink-issue" href="https://github.com/spf13/viper/issues/380" title="GitHub Issue: spf13/viper#380">spf13/viper#380</a>), which prevents comma-separated slices to
<p>This prevents unexpected errors when watchtower starts.</p> be used when using the environment variable.<br />
</blockquote> A workaround is available where we instead put quotes around the environment variable value and replace the commas with
spaces:
<div class="highlight"><pre><span></span><code>WATCHTOWER_NOTIFICATIONS=&quot;slack msteams&quot;
</code></pre></div>
If you're a <code>docker-compose</code> user, make sure to specify environment variables' values in your <code>.yml</code> file without double
quotes (<code>"</code>). This prevents unexpected errors when watchtower starts.</p>
</div>
<h2 id="settings">Settings<a class="headerlink" href="#settings" title="Permanent link">&para;</a></h2> <h2 id="settings">Settings<a class="headerlink" href="#settings" title="Permanent link">&para;</a></h2>
<ul> <ul>
<li><code>--notifications-level</code> (env. <code>WATCHTOWER_NOTIFICATIONS_LEVEL</code>): Controls the log level which is used for the notifications. If omitted, the default log level is <code>info</code>. Possible values are: <code>panic</code>, <code>fatal</code>, <code>error</code>, <code>warn</code>, <code>info</code>, <code>debug</code> or <code>trace</code>.</li> <li><code>--notifications-level</code> (env. <code>WATCHTOWER_NOTIFICATIONS_LEVEL</code>): Controls the log level which is used for the notifications. If omitted, the default log level is <code>info</code>. Possible values are: <code>panic</code>, <code>fatal</code>, <code>error</code>, <code>warn</code>, <code>info</code>, <code>debug</code> or <code>trace</code>.</li>
@ -619,7 +627,7 @@ The types of notifications to send are set by passing a comma-separated list of
<li><code>--notification-email-subjecttag</code> (env. <code>WATCHTOWER_NOTIFICATION_EMAIL_SUBJECTTAG</code>): Prefix to include in the subject tag. Useful when running multiple watchtowers.</li> <li><code>--notification-email-subjecttag</code> (env. <code>WATCHTOWER_NOTIFICATION_EMAIL_SUBJECTTAG</code>): Prefix to include in the subject tag. Useful when running multiple watchtowers.</li>
</ul> </ul>
<p>Example:</p> <p>Example:</p>
<div class="codehilite"><pre><span></span><code>docker run -d <span class="se">\</span> <div class="highlight"><pre><span></span><code>docker run -d <span class="se">\</span>
--name watchtower <span class="se">\</span> --name watchtower <span class="se">\</span>
-v /var/run/docker.sock:/var/run/docker.sock <span class="se">\</span> -v /var/run/docker.sock:/var/run/docker.sock <span class="se">\</span>
-e <span class="nv">WATCHTOWER_NOTIFICATIONS</span><span class="o">=</span>email <span class="se">\</span> -e <span class="nv">WATCHTOWER_NOTIFICATIONS</span><span class="o">=</span>email <span class="se">\</span>
@ -632,12 +640,10 @@ The types of notifications to send are set by passing a comma-separated list of
-e <span class="nv">WATCHTOWER_NOTIFICATION_EMAIL_DELAY</span><span class="o">=</span><span class="m">2</span> <span class="se">\</span> -e <span class="nv">WATCHTOWER_NOTIFICATION_EMAIL_DELAY</span><span class="o">=</span><span class="m">2</span> <span class="se">\</span>
containrrr/watchtower containrrr/watchtower
</code></pre></div> </code></pre></div>
<p>The previous example assumes, that you already have an SMTP server up and running you can connect to. If you don't or you want to bring up watchtower with your own simple SMTP relay the following <code>docker-compose.yml</code> might be a good start for you.</p> <p>The previous example assumes, that you already have an SMTP server up and running you can connect to. If you don't or you want to bring up watchtower with your own simple SMTP relay the following <code>docker-compose.yml</code> might be a good start for you.</p>
<p>The following example assumes, that your domain is called <code>your-domain.com</code> and that you are going to use a certificate valid for <code>smtp.your-domain.com</code>. This hostname has to be used as <code>WATCHTOWER_NOTIFICATION_EMAIL_SERVER</code> otherwise the TLS connection is going to fail with <code>Failed to send notification email</code> or <code>connect: connection refused</code>. We also have to add a network for this setup in order to add an alias to it. If you also want to enable DKIM or other features on the SMTP server, you will find more information at <a href="https://hub.docker.com/r/freinet/postfix-relay">freinet/postfix-relay</a>.</p> <p>The following example assumes, that your domain is called <code>your-domain.com</code> and that you are going to use a certificate valid for <code>smtp.your-domain.com</code>. This hostname has to be used as <code>WATCHTOWER_NOTIFICATION_EMAIL_SERVER</code> otherwise the TLS connection is going to fail with <code>Failed to send notification email</code> or <code>connect: connection refused</code>. We also have to add a network for this setup in order to add an alias to it. If you also want to enable DKIM or other features on the SMTP server, you will find more information at <a href="https://hub.docker.com/r/freinet/postfix-relay">freinet/postfix-relay</a>.</p>
<p>Example including an SMTP relay:</p> <p>Example including an SMTP relay:</p>
<div class="codehilite"><pre><span></span><code><span class="nn">---</span> <div class="highlight"><pre><span></span><code><span class="nt">version</span><span class="p">:</span> <span class="s">&#39;3.8&#39;</span>
<span class="nt">version</span><span class="p">:</span> <span class="s">&#39;3.8&#39;</span>
<span class="nt">services</span><span class="p">:</span> <span class="nt">services</span><span class="p">:</span>
<span class="nt">watchtower</span><span class="p">:</span> <span class="nt">watchtower</span><span class="p">:</span>
<span class="nt">image</span><span class="p">:</span> <span class="l l-Scalar l-Scalar-Plain">containrrr/watchtower:latest</span> <span class="nt">image</span><span class="p">:</span> <span class="l l-Scalar l-Scalar-Plain">containrrr/watchtower:latest</span>
@ -679,7 +685,6 @@ The types of notifications to send are set by passing a comma-separated list of
<span class="nt">watchtower</span><span class="p">:</span> <span class="nt">watchtower</span><span class="p">:</span>
<span class="nt">external</span><span class="p">:</span> <span class="l l-Scalar l-Scalar-Plain">false</span> <span class="nt">external</span><span class="p">:</span> <span class="l l-Scalar l-Scalar-Plain">false</span>
</code></pre></div> </code></pre></div>
<h3 id="slack">Slack<a class="headerlink" href="#slack" title="Permanent link">&para;</a></h3> <h3 id="slack">Slack<a class="headerlink" href="#slack" title="Permanent link">&para;</a></h3>
<p>If watchtower is monitoring the same Docker daemon under which the watchtower container itself is running (i.e. if you volume-mounted <em>/var/run/docker.sock</em> into the watchtower container) then it has the ability to update itself. If a new version of the <em>containrrr/watchtower</em> image is pushed to the Docker Hub, your watchtower will pull down the new image and restart itself automatically.</p> <p>If watchtower is monitoring the same Docker daemon under which the watchtower container itself is running (i.e. if you volume-mounted <em>/var/run/docker.sock</em> into the watchtower container) then it has the ability to update itself. If a new version of the <em>containrrr/watchtower</em> image is pushed to the Docker Hub, your watchtower will pull down the new image and restart itself automatically.</p>
<p>To receive notifications in Slack, add <code>slack</code> to the <code>--notifications</code> option or the <code>WATCHTOWER_NOTIFICATIONS</code> environment variable.</p> <p>To receive notifications in Slack, add <code>slack</code> to the <code>--notifications</code> option or the <code>WATCHTOWER_NOTIFICATIONS</code> environment variable.</p>
@ -688,28 +693,23 @@ The types of notifications to send are set by passing a comma-separated list of
<p>Other, optional, variables include:</p> <p>Other, optional, variables include:</p>
<ul> <ul>
<li><code>--notification-slack-channel</code> (env. <code>WATCHTOWER_NOTIFICATION_SLACK_CHANNEL</code>): A string which overrides the webhook's default channel. Example: #my-custom-channel.</li> <li><code>--notification-slack-channel</code> (env. <code>WATCHTOWER_NOTIFICATION_SLACK_CHANNEL</code>): A string which overrides the webhook's default channel. Example: #my-custom-channel.</li>
<li><code>--notification-slack-icon-emoji</code> (env. <code>WATCHTOWER_NOTIFICATION_SLACK_ICON_EMOJI</code>): An <a href="https://www.webpagefx.com/tools/emoji-cheat-sheet/">emoji code</a> string to use in place of the default icon.</li>
<li><code>--notification-slack-icon-url</code> (env. <code>WATCHTOWER_NOTIFICATION_SLACK_ICON_URL</code>): An icon image URL string to use in place of the default icon.</li>
</ul> </ul>
<p>Example:</p> <p>Example:</p>
<div class="codehilite"><pre><span></span><code>docker run -d <span class="se">\</span> <div class="highlight"><pre><span></span><code>docker run -d <span class="se">\</span>
--name watchtower <span class="se">\</span> --name watchtower <span class="se">\</span>
-v /var/run/docker.sock:/var/run/docker.sock <span class="se">\</span> -v /var/run/docker.sock:/var/run/docker.sock <span class="se">\</span>
-e <span class="nv">WATCHTOWER_NOTIFICATIONS</span><span class="o">=</span>slack <span class="se">\</span> -e <span class="nv">WATCHTOWER_NOTIFICATIONS</span><span class="o">=</span>slack <span class="se">\</span>
-e <span class="nv">WATCHTOWER_NOTIFICATION_SLACK_HOOK_URL</span><span class="o">=</span><span class="s2">&quot;https://hooks.slack.com/services/xxx/yyyyyyyyyyyyyyy&quot;</span> <span class="se">\</span> -e <span class="nv">WATCHTOWER_NOTIFICATION_SLACK_HOOK_URL</span><span class="o">=</span><span class="s2">&quot;https://hooks.slack.com/services/xxx/yyyyyyyyyyyyyyy&quot;</span> <span class="se">\</span>
-e <span class="nv">WATCHTOWER_NOTIFICATION_SLACK_IDENTIFIER</span><span class="o">=</span>watchtower-server-1 <span class="se">\</span> -e <span class="nv">WATCHTOWER_NOTIFICATION_SLACK_IDENTIFIER</span><span class="o">=</span>watchtower-server-1 <span class="se">\</span>
-e <span class="nv">WATCHTOWER_NOTIFICATION_SLACK_CHANNEL</span><span class="o">=</span><span class="c1">#my-custom-channel \</span> -e <span class="nv">WATCHTOWER_NOTIFICATION_SLACK_CHANNEL</span><span class="o">=</span><span class="c1">#my-custom-channel \</span>
-e <span class="nv">WATCHTOWER_NOTIFICATION_SLACK_ICON_EMOJI</span><span class="o">=</span>:whale: <span class="se">\</span>
-e <span class="nv">WATCHTOWER_NOTIFICATION_SLACK_ICON_URL</span><span class="o">=</span>&lt;icon url&gt; <span class="se">\</span>
containrrr/watchtower containrrr/watchtower
</code></pre></div> </code></pre></div>
<h3 id="microsoft_teams">Microsoft Teams<a class="headerlink" href="#microsoft_teams" title="Permanent link">&para;</a></h3> <h3 id="microsoft_teams">Microsoft Teams<a class="headerlink" href="#microsoft_teams" title="Permanent link">&para;</a></h3>
<p>To receive notifications in MSTeams channel, add <code>msteams</code> to the <code>--notifications</code> option or the <code>WATCHTOWER_NOTIFICATIONS</code> environment variable.</p> <p>To receive notifications in MSTeams channel, add <code>msteams</code> to the <code>--notifications</code> option or the <code>WATCHTOWER_NOTIFICATIONS</code> environment variable.</p>
<p>Additionally, you should set the MSTeams webhook URL using the <code>--notification-msteams-hook</code> option or the <code>WATCHTOWER_NOTIFICATION_MSTEAMS_HOOK_URL</code> environment variable. This option can also reference a file, in which case the contents of the file are used.</p> <p>Additionally, you should set the MSTeams webhook URL using the <code>--notification-msteams-hook</code> option or the <code>WATCHTOWER_NOTIFICATION_MSTEAMS_HOOK_URL</code> environment variable. This option can also reference a file, in which case the contents of the file are used.</p>
<p>MSTeams notifier could send keys/values filled by <code>log.WithField</code> or <code>log.WithFields</code> as MSTeams message facts. To enable this feature add <code>--notification-msteams-data</code> flag or set <code>WATCHTOWER_NOTIFICATION_MSTEAMS_USE_LOG_DATA=true</code> environment variable.</p> <p>MSTeams notifier could send keys/values filled by <code>log.WithField</code> or <code>log.WithFields</code> as MSTeams message facts. To enable this feature add <code>--notification-msteams-data</code> flag or set <code>WATCHTOWER_NOTIFICATION_MSTEAMS_USE_LOG_DATA=true</code> environment variable.</p>
<p>Example:</p> <p>Example:</p>
<div class="codehilite"><pre><span></span><code>docker run -d <span class="se">\</span> <div class="highlight"><pre><span></span><code>docker run -d <span class="se">\</span>
--name watchtower <span class="se">\</span> --name watchtower <span class="se">\</span>
-v /var/run/docker.sock:/var/run/docker.sock <span class="se">\</span> -v /var/run/docker.sock:/var/run/docker.sock <span class="se">\</span>
-e <span class="nv">WATCHTOWER_NOTIFICATIONS</span><span class="o">=</span>msteams <span class="se">\</span> -e <span class="nv">WATCHTOWER_NOTIFICATIONS</span><span class="o">=</span>msteams <span class="se">\</span>
@ -717,10 +717,9 @@ The types of notifications to send are set by passing a comma-separated list of
-e <span class="nv">WATCHTOWER_NOTIFICATION_MSTEAMS_USE_LOG_DATA</span><span class="o">=</span><span class="nb">true</span> <span class="se">\</span> -e <span class="nv">WATCHTOWER_NOTIFICATION_MSTEAMS_USE_LOG_DATA</span><span class="o">=</span><span class="nb">true</span> <span class="se">\</span>
containrrr/watchtower containrrr/watchtower
</code></pre></div> </code></pre></div>
<h3 id="gotify">Gotify<a class="headerlink" href="#gotify" title="Permanent link">&para;</a></h3> <h3 id="gotify">Gotify<a class="headerlink" href="#gotify" title="Permanent link">&para;</a></h3>
<p>To push a notification to your Gotify instance, register a Gotify app and specify the Gotify URL and app token:</p> <p>To push a notification to your Gotify instance, register a Gotify app and specify the Gotify URL and app token:</p>
<div class="codehilite"><pre><span></span><code>docker run -d <span class="se">\</span> <div class="highlight"><pre><span></span><code>docker run -d <span class="se">\</span>
--name watchtower <span class="se">\</span> --name watchtower <span class="se">\</span>
-v /var/run/docker.sock:/var/run/docker.sock <span class="se">\</span> -v /var/run/docker.sock:/var/run/docker.sock <span class="se">\</span>
-e <span class="nv">WATCHTOWER_NOTIFICATIONS</span><span class="o">=</span>gotify <span class="se">\</span> -e <span class="nv">WATCHTOWER_NOTIFICATIONS</span><span class="o">=</span>gotify <span class="se">\</span>
@ -728,7 +727,6 @@ The types of notifications to send are set by passing a comma-separated list of
-e <span class="nv">WATCHTOWER_NOTIFICATION_GOTIFY_TOKEN</span><span class="o">=</span><span class="s2">&quot;SuperSecretToken&quot;</span> <span class="se">\</span> -e <span class="nv">WATCHTOWER_NOTIFICATION_GOTIFY_TOKEN</span><span class="o">=</span><span class="s2">&quot;SuperSecretToken&quot;</span> <span class="se">\</span>
containrrr/watchtower containrrr/watchtower
</code></pre></div> </code></pre></div>
<p><code>-e WATCHTOWER_NOTIFICATION_GOTIFY_TOKEN</code> or <code>--notification-gotify-token</code> can also reference a file, in which case the contents of the file are used.</p> <p><code>-e WATCHTOWER_NOTIFICATION_GOTIFY_TOKEN</code> or <code>--notification-gotify-token</code> can also reference a file, in which case the contents of the file are used.</p>
<p>If you want to disable TLS verification for the Gotify instance, you can use either <code>-e WATCHTOWER_NOTIFICATION_GOTIFY_TLS_SKIP_VERIFY=true</code> or <code>--notification-gotify-tls-skip-verify</code>.</p> <p>If you want to disable TLS verification for the Gotify instance, you can use either <code>-e WATCHTOWER_NOTIFICATION_GOTIFY_TLS_SKIP_VERIFY=true</code> or <code>--notification-gotify-tls-skip-verify</code>.</p>
<h3 id="containrrrshoutrrr"><a href="https://github.com/containrrr/shoutrrr">containrrr/shoutrrr</a><a class="headerlink" href="#containrrrshoutrrr" title="Permanent link">&para;</a></h3> <h3 id="containrrrshoutrrr"><a href="https://github.com/containrrr/shoutrrr">containrrr/shoutrrr</a><a class="headerlink" href="#containrrrshoutrrr" title="Permanent link">&para;</a></h3>
@ -736,16 +734,26 @@ The types of notifications to send are set by passing a comma-separated list of
<ul> <ul>
<li><code>--notification-url</code> (env. <code>WATCHTOWER_NOTIFICATION_URL</code>): The shoutrrr service URL to be used.</li> <li><code>--notification-url</code> (env. <code>WATCHTOWER_NOTIFICATION_URL</code>): The shoutrrr service URL to be used.</li>
</ul> </ul>
<p>Go to <a href="https://containrrr.github.io/shoutrrr/services/overview">containrrr.github.io/shoutrrr/services/overview</a> to learn more about the different service URLs you can use. <p>Go to <a href="https://containrrr.github.io/shoutrrr/services/overview">containrrr.github.io/shoutrrr/services/overview</a> to
You can define multiple services by space separating the URLs. (See example below)</p> learn more about the different service URLs you can use. You can define multiple services by space separating the
URLs. (See example below)</p>
<p>You can customize the message posted by setting a template.</p> <p>You can customize the message posted by setting a template.</p>
<ul> <ul>
<li><code>--notification-template</code> (env. <code>WATCHTOWER_NOTIFICATION_TEMPLATE</code>): The template used for the message.</li> <li><code>--notification-template</code> (env. <code>WATCHTOWER_NOTIFICATION_TEMPLATE</code>): The template used for the message.</li>
</ul> </ul>
<p>The template is a Go <a href="https://golang.org/pkg/text/template/">template</a> and the you format a list of <a href="https://pkg.go.dev/github.com/sirupsen/logrus?tab=doc#Entry">log entries</a>.</p> <p>The template is a Go <a href="https://golang.org/pkg/text/template/">template</a> and that format a list
<p>The default value if not set is <code>{{range .}}{{.Message}}{{println}}{{end}}</code>. The example below uses a template that also outputs timestamp and log level.</p> of <a href="https://pkg.go.dev/github.com/sirupsen/logrus?tab=doc#Entry">log entries</a>.</p>
<p>The default value if not set is <code>{{range .}}{{.Message}}{{println}}{{end}}</code>. The example below uses a template that also
outputs timestamp and log level.</p>
<div class="admonition tip">
<p class="admonition-title">Custom date format</p>
<p>If you want to adjust the date/time format it must show how the
<a href="https://golang.org/pkg/time/#pkg-constants">reference time</a> (<em>Mon Jan 2 15:04:05 MST 2006</em>) would be displayed in your
custom format.<br />
i.e. The day of the year has to be 1, the month has to be 2 (february), the hour 3 (or 15 for 24h time) etc.</p>
</div>
<p>Example:</p> <p>Example:</p>
<div class="codehilite"><pre><span></span><code>docker run -d <span class="se">\</span> <div class="highlight"><pre><span></span><code>docker run -d <span class="se">\</span>
--name watchtower <span class="se">\</span> --name watchtower <span class="se">\</span>
-v /var/run/docker.sock:/var/run/docker.sock <span class="se">\</span> -v /var/run/docker.sock:/var/run/docker.sock <span class="se">\</span>
-e <span class="nv">WATCHTOWER_NOTIFICATIONS</span><span class="o">=</span>shoutrrr <span class="se">\</span> -e <span class="nv">WATCHTOWER_NOTIFICATIONS</span><span class="o">=</span>shoutrrr <span class="se">\</span>

@ -9,7 +9,7 @@
<link rel="canonical" href="http://containrrr.github.io/watchtower/private-registries/"> <link rel="canonical" href="https://containrrr.dev/watchtower/private-registries/">
<link rel="icon" href="../images/favicon.ico"> <link rel="icon" href="../images/favicon.ico">
<meta name="generator" content="mkdocs-1.1.2, mkdocs-material-7.1.3"> <meta name="generator" content="mkdocs-1.1.2, mkdocs-material-7.1.3">
@ -320,13 +320,6 @@
Create the configuration file manually Create the configuration file manually
</a> </a>
</li>
<li class="md-nav__item">
<a href="#i_username_and_password_for_gcloud" class="md-nav__link">
Username and Password for GCloud
</a>
</li> </li>
<li class="md-nav__item"> <li class="md-nav__item">
@ -367,27 +360,6 @@
</ul> </ul>
</nav> </nav>
</li>
<li class="md-nav__item">
<a href="#create_a_volume_to_store_the_command_once_built" class="md-nav__link">
Create a volume to store the command (once built)
</a>
</li>
<li class="md-nav__item">
<a href="#build_the_container" class="md-nav__link">
Build the container
</a>
</li>
<li class="md-nav__item">
<a href="#build_the_command_and_store_it_in_the_new_volume_in_the_gobin_directory" class="md-nav__link">
Build the command and store it in the new volume in the /go/bin directory.
</a>
</li> </li>
</ul> </ul>
@ -531,13 +503,6 @@
Create the configuration file manually Create the configuration file manually
</a> </a>
</li>
<li class="md-nav__item">
<a href="#i_username_and_password_for_gcloud" class="md-nav__link">
Username and Password for GCloud
</a>
</li> </li>
<li class="md-nav__item"> <li class="md-nav__item">
@ -578,27 +543,6 @@
</ul> </ul>
</nav> </nav>
</li>
<li class="md-nav__item">
<a href="#create_a_volume_to_store_the_command_once_built" class="md-nav__link">
Create a volume to store the command (once built)
</a>
</li>
<li class="md-nav__item">
<a href="#build_the_container" class="md-nav__link">
Build the container
</a>
</li>
<li class="md-nav__item">
<a href="#build_the_command_and_store_it_in_the_new_volume_in_the_gobin_directory" class="md-nav__link">
Build the command and store it in the new volume in the /go/bin directory.
</a>
</li> </li>
</ul> </ul>
@ -618,6 +562,8 @@
</a> </a>
<h1>Private registries</h1>
<p>Watchtower supports private Docker image registries. In many cases, accessing a private registry <p>Watchtower supports private Docker image registries. In many cases, accessing a private registry
requires a valid username and password (i.e., <em>credentials</em>). In order to operate in such an requires a valid username and password (i.e., <em>credentials</em>). In order to operate in such an
environment, watchtower needs to know the credentials to access the registry. </p> environment, watchtower needs to know the credentials to access the registry. </p>
@ -630,7 +576,7 @@ There are two ways to generate this configuration file:</p>
<h3 id="create_the_configuration_file_manually">Create the configuration file manually<a class="headerlink" href="#create_the_configuration_file_manually" title="Permanent link">&para;</a></h3> <h3 id="create_the_configuration_file_manually">Create the configuration file manually<a class="headerlink" href="#create_the_configuration_file_manually" title="Permanent link">&para;</a></h3>
<p>Create a new configuration file with the following syntax and a base64 encoded username and <p>Create a new configuration file with the following syntax and a base64 encoded username and
password <code>auth</code> string:</p> password <code>auth</code> string:</p>
<div class="codehilite"><pre><span></span><code><span class="p">{</span> <div class="highlight"><pre><span></span><code><span class="p">{</span>
<span class="nt">&quot;auths&quot;</span><span class="p">:</span> <span class="p">{</span> <span class="nt">&quot;auths&quot;</span><span class="p">:</span> <span class="p">{</span>
<span class="nt">&quot;&lt;REGISTRY_NAME&gt;&quot;</span><span class="p">:</span> <span class="p">{</span> <span class="nt">&quot;&lt;REGISTRY_NAME&gt;&quot;</span><span class="p">:</span> <span class="p">{</span>
<span class="nt">&quot;auth&quot;</span><span class="p">:</span> <span class="s2">&quot;XXXXXXX&quot;</span> <span class="nt">&quot;auth&quot;</span><span class="p">:</span> <span class="s2">&quot;XXXXXXX&quot;</span>
@ -638,36 +584,31 @@ password <code>auth</code> string:</p>
<span class="p">}</span> <span class="p">}</span>
<span class="p">}</span> <span class="p">}</span>
</code></pre></div> </code></pre></div>
<p><code>&lt;REGISTRY_NAME&gt;</code> needs to be replaced by the name of your private registry <p><code>&lt;REGISTRY_NAME&gt;</code> needs to be replaced by the name of your private registry
(e.g., <code>my-private-registry.example.org</code>)</p> (e.g., <code>my-private-registry.example.org</code>)</p>
<p>The required <code>auth</code> string can be generated as follows:</p> <p>The required <code>auth</code> string can be generated as follows:</p>
<div class="codehilite"><pre><span></span><code><span class="nb">echo</span> -n <span class="s1">&#39;username:password&#39;</span> <span class="p">|</span> base64 <div class="highlight"><pre><span></span><code><span class="nb">echo</span> -n <span class="s1">&#39;username:password&#39;</span> <span class="p">|</span> base64
</code></pre></div> </code></pre></div>
<div class="admonition info">
<blockquote> <p class="admonition-title">Username and Password for GCloud</p>
<h3 id="i_username_and_password_for_gcloud"> Username and Password for GCloud<a class="headerlink" href="#i_username_and_password_for_gcloud" title="Permanent link">&para;</a></h3> <p>For gcloud, we'll use <code>_json_key</code> as our username and the content of <code>gcloudauth.json</code> as the password.
<p>For gcloud, we'll use <code>_json_key</code> as our username and the content <div class="highlight"><pre><span></span><code>bash echo -n &quot;_json_key:$(cat gcloudauth.json)&quot; | base64 -w0
of <code>gcloudauth.json</code> as the password. </code></pre></div></p>
<code>bash </div>
echo -n "_json_key:$(cat gcloudauth.json)" | base64 -w0</code> <p>When the watchtower Docker container is started, the created configuration file
When the watchtower Docker container is started, the created configuration file
(<code>&lt;PATH&gt;/config.json</code> in this example) needs to be passed to the container:</p> (<code>&lt;PATH&gt;/config.json</code> in this example) needs to be passed to the container:</p>
</blockquote> <div class="highlight"><pre><span></span><code>docker run <span class="o">[</span>...<span class="o">]</span> -v &lt;PATH&gt;/config.json:/config.json containrrr/watchtower
<div class="codehilite"><pre><span></span><code>docker run <span class="o">[</span>...<span class="o">]</span> -v &lt;PATH&gt;/config.json:/config.json containrrr/watchtower
</code></pre></div> </code></pre></div>
<h3 id="share_the_docker_configuration_file">Share the Docker configuration file<a class="headerlink" href="#share_the_docker_configuration_file" title="Permanent link">&para;</a></h3> <h3 id="share_the_docker_configuration_file">Share the Docker configuration file<a class="headerlink" href="#share_the_docker_configuration_file" title="Permanent link">&para;</a></h3>
<p>To pull an image from a private registry, <code>docker login</code> needs to be called first, to get access <p>To pull an image from a private registry, <code>docker login</code> needs to be called first, to get access
to the registry. The provided credentials are stored in a configuration file called <code>&lt;PATH_TO_HOME_DIR&gt;/.docker/config.json</code>. to the registry. The provided credentials are stored in a configuration file called <code>&lt;PATH_TO_HOME_DIR&gt;/.docker/config.json</code>.
This configuration file can be directly used by watchtower. In this case, the creation of an This configuration file can be directly used by watchtower. In this case, the creation of an
additional configuration file is not necessary.</p> additional configuration file is not necessary.</p>
<p>When the Docker container is started, pass the configuration file to watchtower:</p> <p>When the Docker container is started, pass the configuration file to watchtower:</p>
<div class="codehilite"><pre><span></span><code>docker run <span class="o">[</span>...<span class="o">]</span> -v &lt;PATH_TO_HOME_DIR&gt;/.docker/config.json:/config.json containrrr/watchtower <div class="highlight"><pre><span></span><code>docker run <span class="o">[</span>...<span class="o">]</span> -v &lt;PATH_TO_HOME_DIR&gt;/.docker/config.json:/config.json containrrr/watchtower
</code></pre></div> </code></pre></div>
<p>When creating the watchtower container via docker-compose, use the following lines:</p> <p>When creating the watchtower container via docker-compose, use the following lines:</p>
<div class="codehilite"><pre><span></span><code><span class="nt">version</span><span class="p">:</span> <span class="s">&quot;3.4&quot;</span> <div class="highlight"><pre><span></span><code><span class="nt">version</span><span class="p">:</span> <span class="s">&quot;3.4&quot;</span>
<span class="nt">services</span><span class="p">:</span> <span class="nt">services</span><span class="p">:</span>
<span class="nt">watchtower</span><span class="p">:</span> <span class="nt">watchtower</span><span class="p">:</span>
<span class="nt">image</span><span class="p">:</span> <span class="l l-Scalar l-Scalar-Plain">index.docker.io/containrrr/watchtower:latest</span> <span class="nt">image</span><span class="p">:</span> <span class="l l-Scalar l-Scalar-Plain">index.docker.io/containrrr/watchtower:latest</span>
@ -676,11 +617,10 @@ additional configuration file is not necessary.</p>
<span class="p p-Indicator">-</span> <span class="l l-Scalar l-Scalar-Plain">&lt;PATH_TO_HOME_DIR&gt;/.docker/config.json:/config.json</span> <span class="p p-Indicator">-</span> <span class="l l-Scalar l-Scalar-Plain">&lt;PATH_TO_HOME_DIR&gt;/.docker/config.json:/config.json</span>
<span class="l l-Scalar l-Scalar-Plain">...</span> <span class="l l-Scalar l-Scalar-Plain">...</span>
</code></pre></div> </code></pre></div>
<h4 id="docker_config_path">Docker Config path<a class="headerlink" href="#docker_config_path" title="Permanent link">&para;</a></h4> <h4 id="docker_config_path">Docker Config path<a class="headerlink" href="#docker_config_path" title="Permanent link">&para;</a></h4>
<p>By default, watchtower will look for the <code>config.json</code> file in <code>/</code>, but this can be changed by setting the <code>DOCKER_CONFIG</code> environment variable to the directory path where your config is located. This is useful for setups where the config.json file is changed while the watchtower instance is running, as the changes will not be picked up for a mounted file if the inode changes. <p>By default, watchtower will look for the <code>config.json</code> file in <code>/</code>, but this can be changed by setting the <code>DOCKER_CONFIG</code> environment variable to the directory path where your config is located. This is useful for setups where the config.json file is changed while the watchtower instance is running, as the changes will not be picked up for a mounted file if the inode changes.
Example usage:</p> Example usage:</p>
<div class="codehilite"><pre><span></span><code><span class="nt">version</span><span class="p">:</span> <span class="s">&quot;3.4&quot;</span> <div class="highlight"><pre><span></span><code><span class="nt">version</span><span class="p">:</span> <span class="s">&quot;3.4&quot;</span>
<span class="nt">services</span><span class="p">:</span> <span class="nt">services</span><span class="p">:</span>
<span class="nt">watchtower</span><span class="p">:</span> <span class="nt">watchtower</span><span class="p">:</span>
@ -691,7 +631,6 @@ Example usage:</p>
<span class="p p-Indicator">-</span> <span class="l l-Scalar l-Scalar-Plain">/etc/watchtower/config/:/config/</span> <span class="p p-Indicator">-</span> <span class="l l-Scalar l-Scalar-Plain">/etc/watchtower/config/:/config/</span>
<span class="p p-Indicator">-</span> <span class="l l-Scalar l-Scalar-Plain">/var/run/docker.sock:/var/run/docker.sock</span> <span class="p p-Indicator">-</span> <span class="l l-Scalar l-Scalar-Plain">/var/run/docker.sock:/var/run/docker.sock</span>
</code></pre></div> </code></pre></div>
<h2 id="credential_helpers">Credential helpers<a class="headerlink" href="#credential_helpers" title="Permanent link">&para;</a></h2> <h2 id="credential_helpers">Credential helpers<a class="headerlink" href="#credential_helpers" title="Permanent link">&para;</a></h2>
<p>Some private Docker registries (the most prominent probably being AWS ECR) use non-standard ways of authentication. <p>Some private Docker registries (the most prominent probably being AWS ECR) use non-standard ways of authentication.
To be able to use this together with watchtower, we need to use a credential helper.</p> To be able to use this together with watchtower, we need to use a credential helper.</p>
@ -702,9 +641,9 @@ helper in a separate container and mount it using volumes.</p>
<p>Use the dockerfile below to build the <a href="https://github.com/awslabs/amazon-ecr-credential-helper">amazon-ecr-credential-helper</a>, <p>Use the dockerfile below to build the <a href="https://github.com/awslabs/amazon-ecr-credential-helper">amazon-ecr-credential-helper</a>,
in a volume that may be mounted onto your watchtower container.</p> in a volume that may be mounted onto your watchtower container.</p>
<ol> <ol>
<li>Create the Dockerfile (contents below): </li> <li>Create the Dockerfile (contents below):</li>
</ol> </ol>
<div class="codehilite"><pre><span></span><code><span class="k">FROM</span> <span class="s">golang:latest</span> <div class="highlight"><pre><span></span><code><span class="k">FROM</span> <span class="s">golang:latest</span>
<span class="k">ENV</span> CGO_ENABLED <span class="m">0</span> <span class="k">ENV</span> CGO_ENABLED <span class="m">0</span>
<span class="k">ENV</span> REPO github.com/awslabs/amazon-ecr-credential-helper/ecr-login/cli/docker-credential-ecr-login <span class="k">ENV</span> REPO github.com/awslabs/amazon-ecr-credential-helper/ecr-login/cli/docker-credential-ecr-login
@ -719,40 +658,39 @@ in a volume that may be mounted onto your watchtower container.</p>
<span class="k">WORKDIR</span><span class="s"> /go/bin/</span> <span class="k">WORKDIR</span><span class="s"> /go/bin/</span>
</code></pre></div> </code></pre></div>
<ol> <ol>
<li>Use the following commands to build the aws-ecr-dock-cred-helper and store it's output in a volume:</li> <li>Use the following commands to build the aws-ecr-dock-cred-helper and store it's output in a volume:</li>
</ol> </ol>
<p>```shell script</p> <div class="highlight"><pre><span></span><code><span class="c1"># Create a volume to store the command (once built)</span>
<h1 id="create_a_volume_to_store_the_command_once_built">Create a volume to store the command (once built)<a class="headerlink" href="#create_a_volume_to_store_the_command_once_built" title="Permanent link">&para;</a></h1> docker volume create helper
<p>docker volume create helper </p>
<h1 id="build_the_container">Build the container<a class="headerlink" href="#build_the_container" title="Permanent link">&para;</a></h1> <span class="c1"># Build the container</span>
<p>docker build -t aws-ecr-dock-cred-helper .</p> docker build -t aws-ecr-dock-cred-helper .
<h1 id="build_the_command_and_store_it_in_the_new_volume_in_the_gobin_directory">Build the command and store it in the new volume in the /go/bin directory.<a class="headerlink" href="#build_the_command_and_store_it_in_the_new_volume_in_the_gobin_directory" title="Permanent link">&para;</a></h1>
<p>docker run -d --rm --name aws-cred-helper --volume helper:/go/bin aws-ecr-dock-cred-helper</p>
<div class="codehilite"><pre><span></span><code><span class="mf">3.</span> <span class="n">Create</span> <span class="n">a</span> <span class="n">configuration</span> <span class="n">file</span> <span class="kr">for</span> <span class="n">docker</span><span class="p">,</span> <span class="ow">and</span> <span class="n">store</span> <span class="n">it</span> <span class="n">in</span> <span class="err">$</span><span class="n">HOME</span><span class="o">/</span><span class="mf">.</span><span class="n">docker</span><span class="o">/</span><span class="n">config</span><span class="mf">.</span><span class="n">json</span> <span class="p">(</span><span class="n">replace</span> <span class="n">the</span> <span class="o">&lt;</span><span class="n">AWS_ACCOUNT_ID</span><span class="o">&gt;</span>
<span class="n">placeholders</span> <span class="n">with</span> <span class="n">your</span> <span class="n">AWS</span> <span class="n">Account</span> <span class="n">ID</span><span class="p">):</span>
<span class="err">```</span><span class="n">json</span>
<span class="err">{</span>
<span class="s">&quot;credsStore&quot;</span> <span class="p">:</span> <span class="s">&quot;ecr-login&quot;</span><span class="p">,</span>
<span class="s">&quot;HttpHeaders&quot;</span> <span class="p">:</span> <span class="err">{</span>
<span class="s">&quot;User-Agent&quot;</span> <span class="p">:</span> <span class="s">&quot;Docker-Client/19.03.1 (XXXXXX)&quot;</span>
<span class="err">}</span><span class="p">,</span>
<span class="s">&quot;auths&quot;</span> <span class="p">:</span> <span class="err">{</span>
<span class="s">&quot;&lt;AWS_ACCOUNT_ID&gt;.dkr.ecr.us-west-1.amazonaws.com&quot;</span> <span class="p">:</span> <span class="err">{}</span>
<span class="err">}</span><span class="p">,</span>
<span class="s">&quot;credHelpers&quot;</span><span class="p">:</span> <span class="err">{</span>
<span class="s">&quot;&lt;AWS_ACCOUNT_ID&gt;.dkr.ecr.us-west-1.amazonaws.com&quot;</span> <span class="p">:</span> <span class="s">&quot;ecr-login&quot;</span>
<span class="err">}</span>
<span class="err">}</span>
</code></pre></div>
<span class="c1"># Build the command and store it in the new volume in the /go/bin directory.</span>
docker run -d --rm --name aws-cred-helper --volume helper:/go/bin aws-ecr-dock-cred-helper
</code></pre></div>
<ol> <ol>
<li>Create a docker-compose file (as an example) to help launch the container:</li> <li>Create a configuration file for docker, and store it in $HOME/.docker/config.json (replace the <AWS_ACCOUNT_ID>
placeholders with your AWS Account ID):</li>
</ol> </ol>
<p>and the docker-compose definition:</p> <div class="highlight"><pre><span></span><code><span class="p">{</span>
<div class="codehilite"><pre><span></span><code><span class="nt">version</span><span class="p">:</span> <span class="s">&quot;3.4&quot;</span> <span class="nt">&quot;credsStore&quot;</span> <span class="p">:</span> <span class="s2">&quot;ecr-login&quot;</span><span class="p">,</span>
<span class="nt">&quot;HttpHeaders&quot;</span> <span class="p">:</span> <span class="p">{</span>
<span class="nt">&quot;User-Agent&quot;</span> <span class="p">:</span> <span class="s2">&quot;Docker-Client/19.03.1 (XXXXXX)&quot;</span>
<span class="p">},</span>
<span class="nt">&quot;auths&quot;</span> <span class="p">:</span> <span class="p">{</span>
<span class="nt">&quot;&lt;AWS_ACCOUNT_ID&gt;.dkr.ecr.us-west-1.amazonaws.com&quot;</span> <span class="p">:</span> <span class="p">{}</span>
<span class="p">},</span>
<span class="nt">&quot;credHelpers&quot;</span><span class="p">:</span> <span class="p">{</span>
<span class="nt">&quot;&lt;AWS_ACCOUNT_ID&gt;.dkr.ecr.us-west-1.amazonaws.com&quot;</span> <span class="p">:</span> <span class="s2">&quot;ecr-login&quot;</span>
<span class="p">}</span>
<span class="p">}</span>
</code></pre></div>
<ol>
<li>
<p>Create a docker-compose file (as an example) to help launch the container:</p>
<div class="highlight"><pre><span></span><code><span class="nt">version</span><span class="p">:</span> <span class="s">&quot;3.4&quot;</span>
<span class="nt">services</span><span class="p">:</span> <span class="nt">services</span><span class="p">:</span>
<span class="c1"># Check for new images and restart things if a new image exists</span> <span class="c1"># Check for new images and restart things if a new image exists</span>
<span class="c1"># for any of our containers.</span> <span class="c1"># for any of our containers.</span>
@ -770,7 +708,8 @@ in a volume that may be mounted onto your watchtower container.</p>
<span class="nt">helper</span><span class="p">:</span> <span class="nt">helper</span><span class="p">:</span>
<span class="nt">external</span><span class="p">:</span> <span class="l l-Scalar l-Scalar-Plain">true</span> <span class="nt">external</span><span class="p">:</span> <span class="l l-Scalar l-Scalar-Plain">true</span>
</code></pre></div> </code></pre></div>
</li>
</ol>
<p>A few additional notes:</p> <p>A few additional notes:</p>
<ol> <ol>
<li>With docker-compose the volume (helper, in this case) MUST be set to <code>external: true</code>, otherwise docker-compose <li>With docker-compose the volume (helper, in this case) MUST be set to <code>external: true</code>, otherwise docker-compose

@ -9,7 +9,7 @@
<link rel="canonical" href="http://containrrr.github.io/watchtower/remote-hosts/"> <link rel="canonical" href="https://containrrr.dev/watchtower/remote-hosts/">
<link rel="icon" href="../images/favicon.ico"> <link rel="icon" href="../images/favicon.ico">
<meta name="generator" content="mkdocs-1.1.2, mkdocs-material-7.1.3"> <meta name="generator" content="mkdocs-1.1.2, mkdocs-material-7.1.3">
@ -422,18 +422,16 @@
<h1>Remote hosts</h1> <h1>Remote hosts</h1>
<p>By default, watchtower is set-up to monitor the local Docker daemon (the same daemon running the watchtower container itself). However, it is possible to configure watchtower to monitor a remote Docker endpoint. When starting the watchtower container you can specify a remote Docker endpoint with either the <code>--host</code> flag or the <code>DOCKER_HOST</code> environment variable:</p> <p>By default, watchtower is set-up to monitor the local Docker daemon (the same daemon running the watchtower container itself). However, it is possible to configure watchtower to monitor a remote Docker endpoint. When starting the watchtower container you can specify a remote Docker endpoint with either the <code>--host</code> flag or the <code>DOCKER_HOST</code> environment variable:</p>
<div class="codehilite"><pre><span></span><code>docker run -d <span class="se">\</span> <div class="highlight"><pre><span></span><code>docker run -d <span class="se">\</span>
--name watchtower <span class="se">\</span> --name watchtower <span class="se">\</span>
containrrr/watchtower --host <span class="s2">&quot;tcp://10.0.1.2:2375&quot;</span> containrrr/watchtower --host <span class="s2">&quot;tcp://10.0.1.2:2375&quot;</span>
</code></pre></div> </code></pre></div>
<p>or</p> <p>or</p>
<div class="codehilite"><pre><span></span><code>docker run -d <span class="se">\</span> <div class="highlight"><pre><span></span><code>docker run -d <span class="se">\</span>
--name watchtower <span class="se">\</span> --name watchtower <span class="se">\</span>
-e <span class="nv">DOCKER_HOST</span><span class="o">=</span><span class="s2">&quot;tcp://10.0.1.2:2375&quot;</span> <span class="se">\</span> -e <span class="nv">DOCKER_HOST</span><span class="o">=</span><span class="s2">&quot;tcp://10.0.1.2:2375&quot;</span> <span class="se">\</span>
containrrr/watchtower containrrr/watchtower
</code></pre></div> </code></pre></div>
<p>Note in both of the examples above that it is unnecessary to mount the <em>/var/run/docker.sock</em> into the watchtower container.</p> <p>Note in both of the examples above that it is unnecessary to mount the <em>/var/run/docker.sock</em> into the watchtower container.</p>

@ -9,7 +9,7 @@
<link rel="canonical" href="http://containrrr.github.io/watchtower/running-multiple-instances/"> <link rel="canonical" href="https://containrrr.dev/watchtower/running-multiple-instances/">
<link rel="icon" href="../images/favicon.ico"> <link rel="icon" href="../images/favicon.ico">
<meta name="generator" content="mkdocs-1.1.2, mkdocs-material-7.1.3"> <meta name="generator" content="mkdocs-1.1.2, mkdocs-material-7.1.3">
@ -427,7 +427,7 @@
- An instance without a scope will clean up other running instances, even if they have a defined scope;</p> - An instance without a scope will clean up other running instances, even if they have a defined scope;</p>
<p>To define an instance monitoring scope, use the <code>--scope</code> argument or the <code>WATCHTOWER_SCOPE</code> environment variable on startup and set the <em>com.centurylinklabs.watchtower.scope</em> label with the same value for the containers you want to include in this instance's scope (including the instance itself).</p> <p>To define an instance monitoring scope, use the <code>--scope</code> argument or the <code>WATCHTOWER_SCOPE</code> environment variable on startup and set the <em>com.centurylinklabs.watchtower.scope</em> label with the same value for the containers you want to include in this instance's scope (including the instance itself).</p>
<p>For example, in a Docker Compose config file:</p> <p>For example, in a Docker Compose config file:</p>
<div class="codehilite"><pre><span></span><code><span class="nt">version</span><span class="p">:</span> <span class="s">&#39;3&#39;</span> <div class="highlight"><pre><span></span><code><span class="nt">version</span><span class="p">:</span> <span class="s">&#39;3&#39;</span>
<span class="nt">services</span><span class="p">:</span> <span class="nt">services</span><span class="p">:</span>
<span class="nt">app-monitored-by-watchtower</span><span class="p">:</span> <span class="nt">app-monitored-by-watchtower</span><span class="p">:</span>

File diff suppressed because one or more lines are too long

@ -9,7 +9,7 @@
<link rel="canonical" href="http://containrrr.github.io/watchtower/secure-connections/"> <link rel="canonical" href="https://containrrr.dev/watchtower/secure-connections/">
<link rel="icon" href="../images/favicon.ico"> <link rel="icon" href="../images/favicon.ico">
<meta name="generator" content="mkdocs-1.1.2, mkdocs-material-7.1.3"> <meta name="generator" content="mkdocs-1.1.2, mkdocs-material-7.1.3">
@ -424,7 +424,7 @@
<p>Watchtower is also capable of connecting to Docker endpoints which are protected by SSL/TLS. If you've used <em>docker-machine</em> to provision your remote Docker host, you simply need to volume mount the certificates generated by <em>docker-machine</em> into the watchtower container and optionally specify <code>--tlsverify</code> flag.</p> <p>Watchtower is also capable of connecting to Docker endpoints which are protected by SSL/TLS. If you've used <em>docker-machine</em> to provision your remote Docker host, you simply need to volume mount the certificates generated by <em>docker-machine</em> into the watchtower container and optionally specify <code>--tlsverify</code> flag.</p>
<p>The <em>docker-machine</em> certificates for a particular host can be located by executing the <code>docker-machine env</code> command for the desired host (note the values for the <code>DOCKER_HOST</code> and <code>DOCKER_CERT_PATH</code> environment variables that are returned from this command). The directory containing the certificates for the remote host needs to be mounted into the watchtower container at <em>/etc/ssl/docker</em>.</p> <p>The <em>docker-machine</em> certificates for a particular host can be located by executing the <code>docker-machine env</code> command for the desired host (note the values for the <code>DOCKER_HOST</code> and <code>DOCKER_CERT_PATH</code> environment variables that are returned from this command). The directory containing the certificates for the remote host needs to be mounted into the watchtower container at <em>/etc/ssl/docker</em>.</p>
<p>With the certificates mounted into the watchtower container you need to specify the <code>--tlsverify</code> flag to enable verification of the certificate:</p> <p>With the certificates mounted into the watchtower container you need to specify the <code>--tlsverify</code> flag to enable verification of the certificate:</p>
<div class="codehilite"><pre><span></span><code>docker run -d <span class="se">\</span> <div class="highlight"><pre><span></span><code>docker run -d <span class="se">\</span>
--name watchtower <span class="se">\</span> --name watchtower <span class="se">\</span>
-e <span class="nv">DOCKER_HOST</span><span class="o">=</span><span class="nv">$DOCKER_HOST</span> <span class="se">\</span> -e <span class="nv">DOCKER_HOST</span><span class="o">=</span><span class="nv">$DOCKER_HOST</span> <span class="se">\</span>
-e <span class="nv">DOCKER_CERT_PATH</span><span class="o">=</span>/etc/ssl/docker <span class="se">\</span> -e <span class="nv">DOCKER_CERT_PATH</span><span class="o">=</span>/etc/ssl/docker <span class="se">\</span>

@ -1,59 +1,59 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"><url> <urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"><url>
<loc>http://containrrr.github.io/watchtower/</loc> <loc>https://containrrr.dev/watchtower/</loc>
<lastmod>2021-04-24</lastmod> <lastmod>2021-04-27</lastmod>
<changefreq>daily</changefreq> <changefreq>daily</changefreq>
</url><url> </url><url>
<loc>http://containrrr.github.io/watchtower/introduction/</loc> <loc>https://containrrr.dev/watchtower/introduction/</loc>
<lastmod>2021-04-24</lastmod> <lastmod>2021-04-27</lastmod>
<changefreq>daily</changefreq> <changefreq>daily</changefreq>
</url><url> </url><url>
<loc>http://containrrr.github.io/watchtower/usage-overview/</loc> <loc>https://containrrr.dev/watchtower/usage-overview/</loc>
<lastmod>2021-04-24</lastmod> <lastmod>2021-04-27</lastmod>
<changefreq>daily</changefreq> <changefreq>daily</changefreq>
</url><url> </url><url>
<loc>http://containrrr.github.io/watchtower/arguments/</loc> <loc>https://containrrr.dev/watchtower/arguments/</loc>
<lastmod>2021-04-24</lastmod> <lastmod>2021-04-27</lastmod>
<changefreq>daily</changefreq> <changefreq>daily</changefreq>
</url><url> </url><url>
<loc>http://containrrr.github.io/watchtower/notifications/</loc> <loc>https://containrrr.dev/watchtower/notifications/</loc>
<lastmod>2021-04-24</lastmod> <lastmod>2021-04-27</lastmod>
<changefreq>daily</changefreq> <changefreq>daily</changefreq>
</url><url> </url><url>
<loc>http://containrrr.github.io/watchtower/container-selection/</loc> <loc>https://containrrr.dev/watchtower/container-selection/</loc>
<lastmod>2021-04-24</lastmod> <lastmod>2021-04-27</lastmod>
<changefreq>daily</changefreq> <changefreq>daily</changefreq>
</url><url> </url><url>
<loc>http://containrrr.github.io/watchtower/private-registries/</loc> <loc>https://containrrr.dev/watchtower/private-registries/</loc>
<lastmod>2021-04-24</lastmod> <lastmod>2021-04-27</lastmod>
<changefreq>daily</changefreq> <changefreq>daily</changefreq>
</url><url> </url><url>
<loc>http://containrrr.github.io/watchtower/linked-containers/</loc> <loc>https://containrrr.dev/watchtower/linked-containers/</loc>
<lastmod>2021-04-24</lastmod> <lastmod>2021-04-27</lastmod>
<changefreq>daily</changefreq> <changefreq>daily</changefreq>
</url><url> </url><url>
<loc>http://containrrr.github.io/watchtower/remote-hosts/</loc> <loc>https://containrrr.dev/watchtower/remote-hosts/</loc>
<lastmod>2021-04-24</lastmod> <lastmod>2021-04-27</lastmod>
<changefreq>daily</changefreq> <changefreq>daily</changefreq>
</url><url> </url><url>
<loc>http://containrrr.github.io/watchtower/secure-connections/</loc> <loc>https://containrrr.dev/watchtower/secure-connections/</loc>
<lastmod>2021-04-24</lastmod> <lastmod>2021-04-27</lastmod>
<changefreq>daily</changefreq> <changefreq>daily</changefreq>
</url><url> </url><url>
<loc>http://containrrr.github.io/watchtower/stop-signals/</loc> <loc>https://containrrr.dev/watchtower/stop-signals/</loc>
<lastmod>2021-04-24</lastmod> <lastmod>2021-04-27</lastmod>
<changefreq>daily</changefreq> <changefreq>daily</changefreq>
</url><url> </url><url>
<loc>http://containrrr.github.io/watchtower/lifecycle-hooks/</loc> <loc>https://containrrr.dev/watchtower/lifecycle-hooks/</loc>
<lastmod>2021-04-24</lastmod> <lastmod>2021-04-27</lastmod>
<changefreq>daily</changefreq> <changefreq>daily</changefreq>
</url><url> </url><url>
<loc>http://containrrr.github.io/watchtower/running-multiple-instances/</loc> <loc>https://containrrr.dev/watchtower/running-multiple-instances/</loc>
<lastmod>2021-04-24</lastmod> <lastmod>2021-04-27</lastmod>
<changefreq>daily</changefreq> <changefreq>daily</changefreq>
</url><url> </url><url>
<loc>http://containrrr.github.io/watchtower/metrics/</loc> <loc>https://containrrr.dev/watchtower/metrics/</loc>
<lastmod>2021-04-24</lastmod> <lastmod>2021-04-27</lastmod>
<changefreq>daily</changefreq> <changefreq>daily</changefreq>
</url> </url>
</urlset> </urlset>

Binary file not shown.

@ -9,7 +9,7 @@
<link rel="canonical" href="http://containrrr.github.io/watchtower/stop-signals/"> <link rel="canonical" href="https://containrrr.dev/watchtower/stop-signals/">
<link rel="icon" href="../images/favicon.ico"> <link rel="icon" href="../images/favicon.ico">
<meta name="generator" content="mkdocs-1.1.2, mkdocs-material-7.1.3"> <meta name="generator" content="mkdocs-1.1.2, mkdocs-material-7.1.3">
@ -424,11 +424,10 @@
<p>When watchtower detects that a running container needs to be updated it will stop the container by sending it a SIGTERM signal. <p>When watchtower detects that a running container needs to be updated it will stop the container by sending it a SIGTERM signal.
If your container should be shutdown with a different signal you can communicate this to watchtower by setting a label named <em>com.centurylinklabs.watchtower.stop-signal</em> with the value of the desired signal.</p> If your container should be shutdown with a different signal you can communicate this to watchtower by setting a label named <em>com.centurylinklabs.watchtower.stop-signal</em> with the value of the desired signal.</p>
<p>This label can be coded directly into your image by using the <code>LABEL</code> instruction in your Dockerfile:</p> <p>This label can be coded directly into your image by using the <code>LABEL</code> instruction in your Dockerfile:</p>
<div class="codehilite"><pre><span></span><code><span class="k">LABEL</span> com.centurylinklabs.watchtower.stop-signal<span class="o">=</span><span class="s2">&quot;SIGHUP&quot;</span> <div class="highlight"><pre><span></span><code><span class="k">LABEL</span> com.centurylinklabs.watchtower.stop-signal<span class="o">=</span><span class="s2">&quot;SIGHUP&quot;</span>
</code></pre></div> </code></pre></div>
<p>Or, it can be specified as part of the <code>docker run</code> command line:</p> <p>Or, it can be specified as part of the <code>docker run</code> command line:</p>
<div class="codehilite"><pre><span></span><code>docker run -d --label<span class="o">=</span>com.centurylinklabs.watchtower.stop-signal<span class="o">=</span>SIGHUP someimage <div class="highlight"><pre><span></span><code>docker run -d --label<span class="o">=</span>com.centurylinklabs.watchtower.stop-signal<span class="o">=</span>SIGHUP someimage
</code></pre></div> </code></pre></div>

@ -9,7 +9,7 @@
<link rel="canonical" href="http://containrrr.github.io/watchtower/usage-overview/"> <link rel="canonical" href="https://containrrr.dev/watchtower/usage-overview/">
<link rel="icon" href="../images/favicon.ico"> <link rel="icon" href="../images/favicon.ico">
<meta name="generator" content="mkdocs-1.1.2, mkdocs-material-7.1.3"> <meta name="generator" content="mkdocs-1.1.2, mkdocs-material-7.1.3">
@ -424,37 +424,44 @@
<p>Watchtower is itself packaged as a Docker container so installation is as simple as pulling the <code>containrrr/watchtower</code> image. If you are using ARM based architecture, pull the appropriate <code>containrrr/watchtower:armhf-&lt;tag&gt;</code> image from the <a href="https://hub.docker.com/r/containrrr/watchtower/tags/">containrrr Docker Hub</a>.</p> <p>Watchtower is itself packaged as a Docker container so installation is as simple as pulling the <code>containrrr/watchtower</code> image. If you are using ARM based architecture, pull the appropriate <code>containrrr/watchtower:armhf-&lt;tag&gt;</code> image from the <a href="https://hub.docker.com/r/containrrr/watchtower/tags/">containrrr Docker Hub</a>.</p>
<p>Since the watchtower code needs to interact with the Docker API in order to monitor the running containers, you need to mount <em>/var/run/docker.sock</em> into the container with the <code>-v</code> flag when you run it.</p> <p>Since the watchtower code needs to interact with the Docker API in order to monitor the running containers, you need to mount <em>/var/run/docker.sock</em> into the container with the <code>-v</code> flag when you run it.</p>
<p>Run the <code>watchtower</code> container with the following command:</p> <p>Run the <code>watchtower</code> container with the following command:</p>
<div class="codehilite"><pre><span></span><code>docker run -d <span class="se">\</span> <div class="highlight"><pre><span></span><code>docker run -d <span class="se">\</span>
--name watchtower <span class="se">\</span> --name watchtower <span class="se">\</span>
-v /var/run/docker.sock:/var/run/docker.sock <span class="se">\</span> -v /var/run/docker.sock:/var/run/docker.sock <span class="se">\</span>
containrrr/watchtower containrrr/watchtower
</code></pre></div> </code></pre></div>
<p>If pulling images from private Docker registries, supply registry authentication credentials with the environment variables <code>REPO_USER</code> and <code>REPO_PASS</code> <p>If pulling images from private Docker registries, supply registry authentication credentials with the environment variables <code>REPO_USER</code> and <code>REPO_PASS</code>
or by mounting the host's docker config file into the container (at the root of the container filesystem <code>/</code>).</p> or by mounting the host's docker config file into the container (at the root of the container filesystem <code>/</code>).</p>
<p>Passing environment variables:</p> <p>Passing environment variables:</p>
<div class="codehilite"><pre><span></span><code>docker run -d <span class="se">\</span> <div class="highlight"><pre><span></span><code>docker run -d <span class="se">\</span>
--name watchtower <span class="se">\</span> --name watchtower <span class="se">\</span>
-e <span class="nv">REPO_USER</span><span class="o">=</span>username <span class="se">\</span> -e <span class="nv">REPO_USER</span><span class="o">=</span>username <span class="se">\</span>
-e <span class="nv">REPO_PASS</span><span class="o">=</span>password <span class="se">\</span> -e <span class="nv">REPO_PASS</span><span class="o">=</span>password <span class="se">\</span>
-v /var/run/docker.sock:/var/run/docker.sock <span class="se">\</span> -v /var/run/docker.sock:/var/run/docker.sock <span class="se">\</span>
containrrr/watchtower container_to_watch --debug containrrr/watchtower container_to_watch --debug
</code></pre></div> </code></pre></div>
<p>Also check out <a href="https://stackoverflow.com/a/30494145/7872793">this Stack Overflow answer</a> for more options on how to pass environment variables.</p> <p>Also check out <a href="https://stackoverflow.com/a/30494145/7872793">this Stack Overflow answer</a> for more options on how to pass environment variables.</p>
<p>Mounting the host's docker config file:</p> <p>Mounting the host's docker config file:</p>
<div class="codehilite"><pre><span></span><code>docker run -d <span class="se">\</span> <div class="highlight"><pre><span></span><code>docker run -d <span class="se">\</span>
--name watchtower <span class="se">\</span> --name watchtower <span class="se">\</span>
-v /home/&lt;user&gt;/.docker/config.json:/config.json <span class="se">\</span> -v /home/&lt;user&gt;/.docker/config.json:/config.json <span class="se">\</span>
-v /var/run/docker.sock:/var/run/docker.sock <span class="se">\</span> -v /var/run/docker.sock:/var/run/docker.sock <span class="se">\</span>
containrrr/watchtower container_to_watch --debug containrrr/watchtower container_to_watch --debug
</code></pre></div> </code></pre></div>
<div class="admonition note">
<blockquote> <p class="admonition-title">Changes to config.json while running</p>
<p>NOTE: if you mount <code>config.json</code> in the manner above, changes from the host system will (generally) not be propagated to the running container. Mounting files into the Docker daemon uses bind mounts, which are based on inodes. Most applications (including <code>docker login</code> and <code>vim</code>) will not directly edit the file, but instead make a copy and replace the original file, which results in a new inode which in turn <em>breaks</em> the bind mount. <strong>As a workaround</strong>, you can create a symlink to your <code>config.json</code> file and then mount the symlink in the container. The symlinked file will always have the same inode, which keeps the bind mount intact and will ensure changes to the original file are propagated to the running container (regardless of the inode of the source file!).</p> <p>If you mount <code>config.json</code> in the manner above, changes from the host system will (generally) not be propagated to the
</blockquote> running container. Mounting files into the Docker daemon uses bind mounts, which are based on inodes. Most
<p>If you mount the config file as described above, be sure to also prepend the URL for the registry when starting up your watched image (you can omit the https://). Here is a complete docker-compose.yml file that starts up a docker container from a private repo at Docker Hub and monitors it with watchtower. Note the command argument changing the interval to 30s rather than the default 24 hours.</p> applications (including <code>docker login</code> and <code>vim</code>) will not directly edit the file, but instead make a copy and replace
<div class="codehilite"><pre><span></span><code><span class="nt">version</span><span class="p">:</span> <span class="s">&quot;3&quot;</span> the original file, which results in a new inode which in turn <em>breaks</em> the bind mount.<br />
<strong>As a workaround</strong>, you can create a symlink to your <code>config.json</code> file and then mount the symlink in the container.
The symlinked file will always have the same inode, which keeps the bind mount intact and will ensure changes
to the original file are propagated to the running container (regardless of the inode of the source file!).</p>
</div>
<p>If you mount the config file as described above, be sure to also prepend the URL for the registry when starting up your
watched image (you can omit the https://). Here is a complete docker-compose.yml file that starts up a docker container
from a private repo at Docker Hub and monitors it with watchtower. Note the command argument changing the interval to
30s rather than the default 24 hours.</p>
<div class="highlight"><pre><span></span><code><span class="nt">version</span><span class="p">:</span> <span class="s">&quot;3&quot;</span>
<span class="nt">services</span><span class="p">:</span> <span class="nt">services</span><span class="p">:</span>
<span class="nt">cavo</span><span class="p">:</span> <span class="nt">cavo</span><span class="p">:</span>
<span class="nt">image</span><span class="p">:</span> <span class="l l-Scalar l-Scalar-Plain">index.docker.io/&lt;org&gt;/&lt;image&gt;:&lt;tag&gt;</span> <span class="nt">image</span><span class="p">:</span> <span class="l l-Scalar l-Scalar-Plain">index.docker.io/&lt;org&gt;/&lt;image&gt;:&lt;tag&gt;</span>

Loading…
Cancel
Save