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.json file is available locally.
  • The microshift-containers directory contents are available locally.

Procedure

  1. Install the skopeo tool used for copying the container images by running the following command:

    $ sudo dnf install -y skopeo
  2. Set the environment variables pointing to the pull secret file:

    $ IMAGE_PULL_FILE=~/.pull-secret-mirror.json
  3. Set the environment variables pointing to the local container image directory:

    $ IMAGE_LOCAL_DIR=~/microshift-containers
  4. Set 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.
  5. 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
Red Hat logoGithubredditYoutubeTwitter

学习

尝试、购买和销售

社区

關於紅帽

我们提供强化的解决方案,使企业能够更轻松地跨平台和环境(从核心数据中心到网络边缘)工作。

让开源更具包容性

红帽致力于替换我们的代码、文档和 Web 属性中存在问题的语言。欲了解更多详情,请参阅红帽博客.

关于红帽文档

Legal Notice

Theme

© 2026 Red Hat
返回顶部