github.com/containers/podman/v2@v2.2.2-0.20210501105131-c1e07d070c4c/docs/source/markdown/podman-auto-update.1.md (about)

     1  % podman-auto-update(1)
     2  
     3  ## NAME
     4  podman-auto-update - Auto update containers according to their auto-update policy
     5  
     6  ## SYNOPSIS
     7  **podman auto-update** [*options*]
     8  
     9  ## DESCRIPTION
    10  `podman auto-update` looks up containers with a specified "io.containers.autoupdate" label (i.e., the auto-update policy).
    11  
    12  If the label is present and set to "image", Podman reaches out to the corresponding registry to check if the image has been updated.
    13  An image is considered updated if the digest in the local storage is different than the one of the remote image.
    14  If an image must be updated, Podman pulls it down and restarts the systemd unit executing the container.
    15  
    16  If "io.containers.autoupdate.authfile" label is present, Podman reaches out to corresponding authfile when pulling images.
    17  
    18  At container-creation time, Podman looks up the "PODMAN_SYSTEMD_UNIT" environment variables and stores it verbatim in the container's label.
    19  This variable is now set by all systemd units generated by `podman-generate-systemd` and is set to `%n` (i.e., the name of systemd unit starting the container).
    20  This data is then being used in the auto-update sequence to instruct systemd (via DBUS) to restart the unit and hence to restart the container.
    21  
    22  Note that `podman auto-update` relies on systemd and requires a fully-qualified image reference (e.g., quay.io/podman/stable:latest) to be used to create the container.
    23  This enforcement is necessary to know which image to actually check and pull.
    24  If an image ID was used, Podman would not know which image to check/pull anymore.
    25  
    26  Moreover, the systemd units are expected to be generated with `podman-generate-systemd --new`, or similar units that create new containers in order to run the updated images.
    27  Systemd units that start and stop a container cannot run a new image.
    28  
    29  ## OPTIONS
    30  
    31  #### **--authfile**=*path*
    32  
    33  Path of the authentication file. Default is ${XDG\_RUNTIME\_DIR}/containers/auth.json, which is set using `podman login`.
    34  If the authorization state is not found there, $HOME/.docker/config.json is checked, which is set using `docker login`.
    35  
    36  Note: You can also override the default path of the authentication file by setting the REGISTRY\_AUTH\_FILE
    37  environment variable. `export REGISTRY_AUTH_FILE=path`
    38  
    39  ## EXAMPLES
    40  
    41  ```
    42  # Start a container
    43  $ podman run --label "io.containers.autoupdate=image" \
    44      --label "io.containers.autoupdate.authfile=/some/authfile.json" \
    45      -d busybox:latest top
    46  bc219740a210455fa27deacc96d50a9e20516492f1417507c13ce1533dbdcd9d
    47  
    48  # Generate a systemd unit for this container
    49  $ podman generate systemd --new --files bc219740a210455fa27deacc96d50a9e20516492f1417507c13ce1533dbdcd9d
    50  /home/user/containers/libpod/container-bc219740a210455fa27deacc96d50a9e20516492f1417507c13ce1533dbdcd9d.service
    51  
    52  # Load the new systemd unit and start it
    53  $ mv ./container-bc219740a210455fa27deacc96d50a9e20516492f1417507c13ce1533dbdcd9d.service ~/.config/systemd/user
    54  $ systemctl --user daemon-reload
    55  $ systemctl --user start container-bc219740a210455fa27deacc96d50a9e20516492f1417507c13ce1533dbdcd9d.service
    56  
    57  # Auto-update the container
    58  $ podman auto-update
    59  container-bc219740a210455fa27deacc96d50a9e20516492f1417507c13ce1533dbdcd9d.service
    60  ```
    61  
    62  ## SEE ALSO
    63  podman(1), podman-generate-systemd(1), podman-run(1), systemd.unit(5)