跳转到内容

mise oci push ​

[实验性] 构建 OCI 镜像并将其推送到镜像仓库

Builds from the project's config, as mise oci build does, unless --image-dir names an image layout built earlier. Then uploads only the blobs the registry does not already have. mise pushes with its own registry client, so skopeo, crane, and docker are not needed.

Tool layers whose tool, version, mount point, and file owner match the previously pushed image (or --cache-from) are reused without being rebuilt, so those tools need not be installed locally. Pass --no-cache to rebuild every tool layer.

Credentials come from the files docker and podman use: $REGISTRY_AUTH_FILE, $XDG_RUNTIME_DIR/containers/auth.json, ~/.config/containers/auth.json, then ~/.docker/config.json, including inline auths and credential helpers. Log in with docker login or podman login.

需要 mise settings experimental=true(或 MISE_EXPERIMENTAL=1)。

参数 ​

  • <REF> — 目标镜像仓库引用(例如 ghcr.io/me/devenv:latest)

Flags ​

  • --cache-from <REF> — Reuse unchanged tool layers from this image instead of the destination's current tag

    Must be in the same repository as the destination. Useful when every push gets a new tag, as with per-commit tags in CI: mise oci push --cache-from ghcr.io/me/dev:latest ghcr.io/me/dev:$SHA. Cannot be combined with --no-cache.

  • --from <FROM> — Base image for the build

    Overrides [oci].from and the oci.default_from setting.

  • --image-dir <IMAGE_DIR> — Push an existing OCI image layout instead of building one

    Cannot be combined with --cache-from, --from, --include-global, --mount-point, --no-mise, or --owner.

  • --include-global — Also package tools from the global and system configs

    See mise oci build --help for details.

  • --mount-point <MOUNT_POINT> — Where tools install inside the image

    Overrides [oci].mount_point and the oci.default_mount_point setting.

  • --no-cache — Rebuild tool layers without using the remote or local layer cache

  • --no-mise — Do not embed the running mise binary at /usr/local/bin/mise

  • --owner <UID[:GID]> — UID[:GID] to assign to every tar entry when building

    Overrides [oci].user_id and [oci].group_id. Defaults to 0:0. If GID is omitted, it defaults to UID. This affects file ownership only; [oci].user controls the image USER directive.

  • --update-index — Maintain the tag as a multi-arch image index

    按摘要推送此构建的 manifest,并将标签指向一个 OCI 镜像索引。该索引每个平台包含一个条目,同时保留其他架构已推送的条目。请从每个平台各运行器运行 mise oci push --update-index,以组装多架构标签。

  • -h --help — 打印帮助

示例 ​

Build and push to GHCR

mise oci push ghcr.io/me/devenv:latest

Push an image built earlier

mise oci build -o ./img
mise oci push --image-dir ./img ghcr.io/me/devenv:v1

相关文档 ​