Artica Wiki

Docker: Safe image updates

Update the images of Docker stacks automatically or by hand, with each new image analysed and refused when it is worse than the current one.

Back to Artica for Docker Edition

Keep your applications up to date without letting a worse image in.
Artica downloads each new image of a stack and analyses it before anything changes.
The service switches only when the analysis is acceptable.
If the new containers do not start, the service goes back to its previous image on its own.

The automatic image updates card of a stack

What it does

A tag such as nginx:stable points to a new image every time its publisher releases one.
Pulling that tag blindly can bring in a new vulnerability, a leaked secret or an image that no longer starts.

Artica handles each update of a stack service in this order:

  1. It asks the registry which image the tag points to now.
  2. It downloads that image by its digest.
    The local tag does not move yet.
  3. It analyses the new image with the appliance's Trivy scanner and compares it with the current one.
  4. It applies the update policy of the stack, which accepts or refuses the image.
  5. When the image is accepted, Artica moves the tag, keeps the former image aside and recreates the containers.
  6. If a new container does not start, Artica puts the former containers back.

Each attempt goes into the image update history of the stack, with its outcome and its reason.

DockerArticaAnalyseEtDeploiement.png

Benefits

Use cases

Requirements

Update policies

Each stack has one policy.
It applies to automatic updates and to manual updates started from the console.

Policy A new image is refused when
Not worse than the current image It has more critical vulnerabilities than the current image.
It has more high vulnerabilities than the current image.
It contains more secrets than the current image.
No critical and no high vulnerability It has at least one critical or one high vulnerability.
It contains a secret.
No critical vulnerability It has at least one critical vulnerability.
It contains a secret.

"Not worse than the current image" is the default.
It accepts an imperfect image as long as it is no worse than the one in service.

Update a service by hand

  1. Open Docker > Stacks and click the stack.
  2. Open the Services tab and click Check for updates.
    A service whose registry holds a newer image shows Update available.
  3. Click Update now on that service.
    The download and the analysis can take a few minutes.
  4. Read the result shown under the services.

Result of a manual update refused by the policy

When the policy refuses the image, the result shows the vulnerability counts of the current image and of the new one.
An administrator with the stack edit permission can click Update anyway.
The update is then recorded as Updated by force.
When the image could not be analysed, the button reads Update anyway, without analysis.

A forced update stays in the history and in the Docker audit log.

Schedule automatic updates

  1. Open the stack and its Details tab.
  2. Find the Automatic image updates card.
  3. Tick Update this stack automatically.
  4. Choose the Hour of the day and the Update policy.
  5. Set the Minimum age of the new image (hours).
    0 means no delay.
  6. Tick the Services to update.
    Tick none to update every service built from an image.
  7. Click Save.

The card then shows the Next automatic run and the Last automatic run, as in the screenshot at the top of this page.

How the schedule works:

Automatic updates appear as the user artica-docker in the history and in the audit log.

Go back to the previous image

The history keeps one previous image per service.
Click Go back on the last update of a service and confirm.
The containers are recreated on the former image, and the history gets a Rollback entry.
The image you leave becomes the new previous image.

The previous image keeps a reserved tag that ends with -artica-previous- and eight characters.
The Images page shows it as Kept to go back.
The image cleanup never removes it.
It goes away with its stack.

Image update history

The image update history of a stack

Each line shows the date, the service, the trigger, the outcome and the reason.
It also shows the critical, high and secret counts of the previous image and of the new one.
The last 100 entries are kept.

Outcome Meaning
Updated The new image passed the policy and runs.
Updated by force An administrator accepted an image the policy refused, or an image without analysis.
Refused The policy refused the new image.
The service keeps its image.
Postponed The new image is too recent for the minimum age, or the scanner was busy.
The next run tries again.
Skipped The registry could not be checked, the stack was busy or replicated, or the service was stopped.
Rolled back The new containers did not start.
The former ones were put back.
Failed The update could not finish.
The reason says why.

A service with no newer image adds no line.

Notifications

The outcomes of automatic updates go to the system events of the appliance:

A manual update reports only Rolled back, Failed and Updated by force.
These events need an Artica REST API that knows the Docker events route.
On an older appliance the update runs normally and only the event is missing.

Shared images

Two stacks can use the same image.
An image accepted for one stack is accepted for the whole appliance.
A refusal never deletes an image that was already on the appliance before the update.
When you roll back a service whose new image another stack still runs, the tag stays on the new image.
The service then runs on its previous image under its reserved tag, and the history says so.

Permissions

Action Permission
Read the card and the history See the stacks and analyse compose files
Update a service, force an update, go back Modify and update stacks
Change the schedule and the policy Modify and update stacks

Troubleshooting

Reason shown What to do
The image could not be analysed Enable the CVE scanner and wait for its database.
Check the Image analysis page.
The image scanner is busy Other analyses held the scanner for 30 minutes.
The next run tries again.
The registry is not allowed Add the registry to the image sources on the Docker status page.
The registry could not be checked Check the DNS and the Internet access of the appliance.
The stack is replicated Wait for the replication to finish.
An interrupted update of this service is not settled yet The Docker Manager stopped during an update.
It settles that update at its next start.
The new containers did not start, former ones were put back Read the logs of the service.
The new image may need a configuration change.