Using docker-mirror in a Jenkins pipeline

How to use docker-mirror in a Jenkins pipeline

The following is an example pipeline for Jenkins to perform regular mirrors of common repositories:

 1node( "docker" ) {
 2    [
 3    "alpine:latest",
 4    "debian:11-slim",
 5    "debian:latest",
 6    "golang:alpine",
 7    "openjdk:11"
 8    ].each {
 9        name -> stage( name ) {
10            sh "docker-mirror -d docker.example.com " + name
11        }
12    }
13}

This pipeline will use a jenkins node called "docker" and will run docker-mirror against each one of the listed images, ensuring that the version on docker.example.com is in sync.