Using Bzlmod
Add the following to your MODULE.bazel file:
bazel_dep(name = "rules_img", version = "0.2.8")For further instructions, see the README.
Using WORKSPACE
Add the following to your WORKSPACE.bazel file:
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
http_archive(
    name = "rules_img",
    sha256 = "9cc7b0bafb55f4f6fb1e19b038c18b3ec05dfb5b143e72b7078b92263acf72fc",
    urls = ["https://github.com/bazel-contrib/rules_img/releases/download/v0.2.8/rules_img-v0.2.8.tar.gz"],
)
# Load dependencies
load("@rules_img//img:dependencies.bzl", "rules_img_dependencies")
rules_img_dependencies()
# Register prebuilt toolchains
load("@rules_img//img:repositories.bzl", "img_register_prebuilt_toolchains", "pull_tool_register_prebuilt_repositories")
img_register_prebuilt_toolchains()
register_toolchains("@img_toolchain//:all")
# Register prebuilt pull_tool repositories (for pull functionality)
pull_tool_register_prebuilt_repositories()
# Example: Pull a base image
load("@rules_img//img:pull.bzl", "pull")
pull(
    name = "alpine",
    digest = "sha256:4bcff63911fcb4448bd4fdacec207030997caf25e9bea4045fa6c8c44de311d1",
    registry = "index.docker.io",
    repository = "library/alpine",
    tag = "3.22",
)For more examples, see the README.
What's Changed
- Support multiple tags in image_load rule by @malt3 in #194
 - Document registry authentication by @malt3 in #196
 - containerd image loading platform filtering by @malt3 in #197
 - upgrade bazel nightly to 9.0.0-pre.20251022.1 by @malt3 in #210
 - Add created attribute to image_manifest rule by @malt3 in #212
 - Store Bazel lockfile in Git by @malt3 in #211
 - Platform transition on single-platform image_manifest by @malt3 in #208
 - feat: add tag_file attribute to image_push and image_load by @malt3 in #213
 - Allow for guessing mediaType in more places by @malt3 in #207
 
Full Changelog: v0.2.7...v0.2.8