The oci_load rule seems to drop empty strings from the cmd list. This doesn't happen with rules_docker container_image rule.
The empty string behavior is useful for Java libraries like JCommander that help parse command line args.
To reproduce
WORKSPACE
oci_pull(
name = "distroless_java21",
digest = "sha256:ed5be62a70c5b99708b4ad0fc53bda628d11e46e917f66720fd218cae8fe1568",
image = "gcr.io/distroless/java21-debian12",
)
BUILD
load("@rules_oci//oci:defs.bzl", "oci_image", "oci_load")
oci_image(
name = "test_image",
base = "@distroless_java21",
cmd = [
"hello",
"",
"goodbye",
"",
],
)
oci_load(
name = "test_image_load",
image = ":test_image",
repo_tags = [
"test_image:latest",
],
)
$ bazel run :test_image_load
$ docker inspect test_image:latest
...
"Config": {
"Cmd": [
"hello",
"goodbye"
],
"Entrypoint": [
"/usr/bin/java",
"-jar"
],
...
Notice the empty strings are missing in the CMD list.
- rules_oci v2.2.6
- Bazel version 6.5.0
- Docker version 28.4.0, build d8eb465
The
oci_loadrule seems to drop empty strings from thecmdlist. This doesn't happen with rules_dockercontainer_imagerule.The empty string behavior is useful for Java libraries like JCommander that help parse command line args.
To reproduce
WORKSPACE
BUILD
Notice the empty strings are missing in the CMD list.