Puppet Class: profile::docker::prune_old_images

Defined in:
modules/profile/manifests/docker/prune_old_images.pp

Summary

Alternative to profile::docker::prune. Prunes only old images

Overview

SPDX-License-Identifier: Apache-2.0

Parameters:

  • ensure (Wmflib::Ensure) (defaults to: lookup('docker::prune_old_images::ensure', { default_value => 'present' }))

    Can be provided to control the “ensure” attribute of created resources.

  • older_than (Integer[1]) (defaults to: lookup('docker::prune_old_images::older_than', { default_value => 14 }))

    Specifies the minimum age for an image to be a candidate for pruning. In days.



8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'modules/profile/manifests/docker/prune_old_images.pp', line 8

class profile::docker::prune_old_images(
    Wmflib::Ensure $ensure = lookup('docker::prune_old_images::ensure', { default_value => 'present' }),
    Integer[1] $older_than = lookup('docker::prune_old_images::older_than', { default_value => 14 }),
) {
    systemd::timer::job { 'docker-image-prune-old':
        ensure      => $ensure,
        description => 'Prune old Docker images',
        user        => 'root',
        command     => "/usr/bin/docker image prune --all --force --filter until=${$older_than * 24}h",
        interval    => {
            'start'    => 'OnCalendar',
            'interval' => '*-*-* 1:00 UTC',
        },
    }
}