rules_docker
rules_docker copied to clipboard
Using distroless as layer for `container_image`
Is this supported?
# WORKSPACE
container_pull(
name = "envoyproxy-distroless",
digest = "sha256:319ae2f7889c0ca395da53ca835e04aa09fe2bff23f4fab962853b9d68129bf2", # v1.22-latest
registry = "index.docker.io",
repository = "envoyproxy/envoy-distroless",
)
container_pull(
name = "openjdk",
digest = "sha256:e81b7f317654b0f26d3993e014b04bcb29250339b11b9de41e130feecd4cd43c", # 11
registry = "index.docker.io",
repository = "openjdk",
)
# BUILD
load("@io_bazel_rules_docker//container:container.bzl", "container_image")
container_image(
name = "image",
base = "@openjdk//image",
layers = [
"@envoyproxy-distroless//image",
],
)
Error:
Analyzing: target //docker/uber-image:image (1 packages loaded, 0 targets configured)
ERROR: /usr/local/google/home/aryehh/Development/code/docker/uber-image/BUILD.bazel:3:16: in layers attribute of container_image_ rule //docker/uber-image:image: '@envoyproxy-distroless//image:image' does not have mandatory providers: 'LayerInfo'. Since this rule was created by the macro 'container_image', the error might have been caused by the macro implementation
ERROR: /usr/local/google/home/aryehh/Development/code/docker/uber-image/BUILD.bazel:3:16: Analysis of target '//docker/uber-image:image' failed
ERROR: Analysis of target '//docker/uber-image:image' failed; build aborted:
INFO: Elapsed time: 0.312s
INFO: 0 processes.
FAILED: Build did NOT complete successfully (1 packages loaded, 0 targets configured)
FAILED: Build did NOT complete successfully (1 packages loaded, 0 targets configured)
Any guidance?
Have also tried this, which fails:
load("@io_bazel_rules_docker//container:container.bzl", "container_image")
container_image(
name = "envoy",
base = "@envoyproxy-distroless//image",
)
container_image(
name = "image",
base = "@openjdk//image",
layers = [
":envoy",
],
)
Have also tried this, which succeeds, but within which I cannot find the envoy binary:
container_image(
name = "envoy",
base = "@envoyproxy-distroless//image",
)
container_image(
name = "image",
base = "@openjdk//image",
tars = [
":envoy-layer.tar",
],
)
% docker run --rm -it --entrypoint bash bazel/docker/uber-image:image
root@8f7aae820b9c:/# ls
bin boot dev etc home lib lib64 media mnt opt proc root run sbin srv sys tmp usr var
root@8f7aae820b9c:/# find . -name "*envoy*"
root@8f7aae820b9c:/# find . -iname "*envoy*"
This issue has been automatically marked as stale because it has not had any activity for 180 days. It will be closed if no further activity occurs in 30 days. Collaborators can add an assignee to keep this open indefinitely. Thanks for your contributions to rules_docker!
This issue was automatically closed because it went 30 days without a reply since it was labeled "Can Close?"