2.4. Downloading container images
After you have located the container list and completed the mirroring prerequisites, download the container images to a host with internet access.
Prerequisites
- You are logged into a host with access to the internet.
-
The
.pull-secret-mirror.jsonfile andmicroshift-containersdirectory contents are available locally.
Procedure
Install the
skopeotool used for copying the container images by running the following command:$ sudo dnf install -y skopeoSet the environment variable that points to the pull secret file:
$ PULL_SECRET_FILE=~/.pull-secret-mirror.jsonSet the environment variable that points to the list of container images:
$ IMAGE_LIST_FILE=~/microshift-container-refs.txtSet the environment variable that points to the destination directory for storing the downloaded data:
$ IMAGE_LOCAL_DIR=~/microshift-containersRun the following script to download the container images to the
${IMAGE_LOCAL_DIR}directory:while read -r src_img ; do # Remove the source registry prefix dst_img=$(echo "${src_img}" | cut -d '/' -f 2-) # Run the image download command echo "Downloading '${src_img}' to '${IMAGE_LOCAL_DIR}'" mkdir -p "${IMAGE_LOCAL_DIR}/${dst_img}" skopeo copy --all --quiet \ --preserve-digests \ --authfile "${PULL_SECRET_FILE}" \ docker://"${src_img}" dir://"${IMAGE_LOCAL_DIR}/${dst_img}" done < "${IMAGE_LIST_FILE}"