4.5. Uploading container images to a mirror registry
To use your container images at an air-gapped site, upload them to the mirror registry by using the following procedure.
Prerequisites
-
You logged into a host with access to
microshift-quay. -
The
.pull-secret-mirror.jsonfile is available locally. -
The
microshift-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 variables pointing to the pull secret file:
$ IMAGE_PULL_FILE=~/.pull-secret-mirror.jsonSet the environment variables pointing to the local container image directory:
$ IMAGE_LOCAL_DIR=~/microshift-containersSet the environment variables pointing to the mirror registry URL for uploading the container images:
$ TARGET_REGISTRY=<registry_host>:<port>1 - 1
- Replace
<registry_host>:<port>with the hostname and port of your mirror registry server.
Run the following script to upload the container images to the
${TARGET_REGISTRY}mirror registry:pushd "${IMAGE_LOCAL_DIR}" >/dev/null while read -r src_manifest ; do local src_img src_img=$(dirname "${src_manifest}") # Add the target registry prefix and remove SHA local -r dst_img="${TARGET_REGISTRY}/${src_img}" local -r dst_img_no_tag="${TARGET_REGISTRY}/${src_img%%[@:]*}" # Run the image upload echo "Uploading '${src_img}' to '${dst_img}'" skopeo copy --all --quiet \ --preserve-digests \ --authfile "${IMAGE_PULL_FILE}" \ dir://"${IMAGE_LOCAL_DIR}/${src_img}" docker://"${dst_img}" done < <(find . -type f -name manifest.json -printf '%P\n') popd >/dev/null