{"id":15132162,"url":"https://github.com/googlecontainertools/distroless","last_synced_at":"2025-05-12T03:45:09.509Z","repository":{"id":37381850,"uuid":"88674404","full_name":"GoogleContainerTools/distroless","owner":"GoogleContainerTools","description":"🥑  Language focused docker images, minus the operating system.  ","archived":false,"fork":false,"pushed_at":"2025-05-03T01:06:10.000Z","size":7747,"stargazers_count":20420,"open_issues_count":91,"forks_count":1252,"subscribers_count":197,"default_branch":"main","last_synced_at":"2025-05-08T14:49:33.801Z","etag":null,"topics":["bazel","docker"],"latest_commit_sha":null,"homepage":"","language":"Starlark","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/GoogleContainerTools.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":"SECURITY.md","support":"SUPPORT_POLICY.md","governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2017-04-18T22:02:38.000Z","updated_at":"2025-05-08T08:31:00.000Z","dependencies_parsed_at":"2023-10-14T16:43:16.204Z","dependency_job_id":"6b73d556-82fb-488c-873e-d7d03dfb5cb3","html_url":"https://github.com/GoogleContainerTools/distroless","commit_stats":{"total_commits":1318,"total_committers":152,"mean_commits":8.671052631578947,"dds":0.8019726858877086,"last_synced_commit":"64ac73c84c72528d574413fb246161e4d7d32248"},"previous_names":["googlecloudplatform/distroless"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GoogleContainerTools%2Fdistroless","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GoogleContainerTools%2Fdistroless/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GoogleContainerTools%2Fdistroless/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GoogleContainerTools%2Fdistroless/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/GoogleContainerTools","download_url":"https://codeload.github.com/GoogleContainerTools/distroless/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253671636,"owners_count":21945462,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["bazel","docker"],"created_at":"2024-09-26T04:04:28.221Z","updated_at":"2025-05-12T03:45:09.500Z","avatar_url":"https://github.com/GoogleContainerTools.png","language":"Starlark","readme":"# \"Distroless\" Container Images.\n\n[![CI Build Status](https://github.com/GoogleContainerTools/distroless/actions/workflows/ci.yaml/badge.svg)](https://github.com/GoogleContainerTools/distroless/actions/workflows/ci.yaml)\n\n\"Distroless\" images contain only your application and its runtime dependencies.\nThey do not contain package managers, shells or any other programs you would expect to find in a standard Linux distribution.\n\nFor more information, see this [talk](https://swampup2017.sched.com/event/A6CW/distroless-docker-containerizing-apps-not-vms?iframe=no\u0026w=100%\u0026sidebar=yes\u0026bg=no) ([video](https://www.youtube.com/watch?v=lviLZFciDv4)).\n\n**Since March 2023, Distroless images use oci manifests, if you see errors referencing `application/vnd.oci.image.manifest.v1+json`\nor `application/vnd.oci.image.index.v1+json`, update your container tooling (docker, jib, etc) to latest.**\n\n## Why should I use distroless images?\n\nRestricting what's in your runtime container to precisely what's necessary for your app is a best practice employed by Google\nand other tech giants that have used containers in production for many years.\nIt improves the signal to noise of scanners (e.g. CVE) and reduces the burden of establishing provenance to just what you need.\n\nDistroless images are _very small_.\nThe smallest distroless image, `gcr.io/distroless/static-debian12`, is around 2 MiB.\nThat's about 50% of the size of `alpine` (~5 MiB), and less than 2% of the size of `debian` (124 MiB).\n\n## How do I use distroless images?\n\nThese images are built using [bazel](https://bazel.build), but they can also be used through other Docker image build tooling.\n\n### What images are available?\n\nThe following images are currently published and updated by the distroless project (see [SUPPORT_POLICY.md](SUPPORT_POLICY.md) for support timelines)\n\n#### Debian 12\n\n| Image                                 | Tags                                  | Architecture Suffixes             |\n| ------------------------------------- | ------------------------------------- | --------------------------------- |\n| gcr.io/distroless/static-debian12     | latest, nonroot, debug, debug-nonroot | amd64, arm64, arm, s390x, ppc64le |\n| gcr.io/distroless/base-debian12       | latest, nonroot, debug, debug-nonroot | amd64, arm64, arm, s390x, ppc64le |\n| gcr.io/distroless/base-nossl-debian12 | latest, nonroot, debug, debug-nonroot | amd64, arm64, arm, s390x, ppc64le |\n| gcr.io/distroless/cc-debian12         | latest, nonroot, debug, debug-nonroot | amd64, arm64, arm, s390x, ppc64le |\n| gcr.io/distroless/python3-debian12    | latest, nonroot, debug, debug-nonroot | amd64, arm64                      |\n| gcr.io/distroless/java-base-debian12  | latest, nonroot, debug, debug-nonroot | amd64, arm64, s390x, ppc64le      |\n| gcr.io/distroless/java17-debian12     | latest, nonroot, debug, debug-nonroot | amd64, arm64, s390x, ppc64le      |\n| gcr.io/distroless/java21-debian12     | latest, nonroot, debug, debug-nonroot | amd64, arm64, ppc64le             |\n| gcr.io/distroless/nodejs20-debian12   | latest, nonroot, debug, debug-nonroot | amd64, arm64, arm, s390x, ppc64le |\n| gcr.io/distroless/nodejs22-debian12   | latest, nonroot, debug, debug-nonroot | amd64, arm64, arm, s390x, ppc64le |\n| gcr.io/distroless/nodejs24-debian12   | latest, nonroot, debug, debug-nonroot | amd64, arm64, s390x, ppc64le |\n\nThese images refer to image indexes with references to all supported architectures. Architecture specific images can be directly referenced using an additional architecture suffix on the tag, like `gcr.io/distroless/static-debian12:latest-amd64`\n\nAny other tags are considered deprecated and are no longer updated\n\n## Why is distroless still using gcr.io instead of pkg.dev?\n\nDistroless's serving infrastructure has moved to artifact registry but we still use the gcr.io domain. Users will get the benefits of the newer infrastructure without changing their builds.\n\n## How do I verify distroless images?\n\nAll distroless images are signed by [cosign](https://github.com/sigstore/cosign) with ephemeral keys (keyless) -- this is the only supported mechanism starting November 2023.\nWe recommend verifying any distroless image you use before building your image. You can verify the keyless signature of any distroless image with:\n\n```sh\ncosign verify $IMAGE_NAME --certificate-oidc-issuer https://accounts.google.com  --certificate-identity keyless@distroless.iam.gserviceaccount.com\n```\n\n### Entrypoints\n\nNote that distroless images by default do not contain a shell.\nThat means the Dockerfile `ENTRYPOINT` command, when defined, must be specified in `vector` form, to avoid the container runtime prefixing with a shell.\n\nThis works:\n\n```dockerfile\nENTRYPOINT [\"myapp\"]\n```\n\nBut this does not work:\n\n```dockerfile\nENTRYPOINT \"myapp\"\n```\n\nFor the same reasons, if the entrypoint is set to the empty vector, the CMD command should be specified in `vector` form (see examples below).\nNote that by default static, base and cc images have the empty vector entrypoint. Images with an included language runtime have a language specific default (see: [java](java/README.md#usage), [nodejs](nodejs/README.md#usage), [python3](python3/README.md#usage)).\n\n### Docker\n\nDocker multi-stage builds make using distroless images easy.\nFollow these steps to get started:\n\n- Pick the right base image for your application stack.\n- Write a multi-stage docker file.\n  Note: This requires Docker 17.05 or higher.\n\n  The basic idea is that you'll have one stage to build your application artifacts, and insert them into your runtime distroless image.\n  If you'd like to learn more, please see the documentation on [multi-stage builds](https://docs.docker.com/engine/userguide/eng-image/multistage-build/).\n\n#### Examples with Docker\n\nHere's a quick example for go:\n\n```dockerfile\n# Start by building the application.\nFROM golang:1.18 as build\n\nWORKDIR /go/src/app\nCOPY . .\n\nRUN go mod download\nRUN CGO_ENABLED=0 go build -o /go/bin/app\n\n# Now copy it into our base image.\nFROM gcr.io/distroless/static-debian12\nCOPY --from=build /go/bin/app /\nCMD [\"/app\"]\n```\n\nYou can find other examples here:\n\n- [Java](examples/java/Dockerfile)\n- [Python 3](examples/python3/Dockerfile)\n- [Go](examples/go/Dockerfile)\n- [Node.js](examples/nodejs/Dockerfile)\n- [Rust](examples/rust/Dockerfile)\n\nTo run any example, go to the directory for the language and run:\n\n```sh\ndocker build -t myapp .\ndocker run -t myapp\n```\n\nTo run the [Node.js Express example app](examples/nodejs/node-express) and expose the container's ports:\n\n```sh\nnpm install # Install express and its transitive dependencies\ndocker build -t myexpressapp . # Normal build command\ndocker run -p 3000:3000 -t myexpressapp\n```\n\nThis should expose the Express application to your `localhost:3000`\n\n### Bazel\n\nFor full documentation on how to use bazel to generate Container images, see the [bazel-contrib/rules_oci](https://github.com/bazel-contrib/rules_oci) repository.\n\nFor documentation and example on how to create custom container images, see the [GoogleContainerTools/rules_distroless](https://github.com/GoogleContainerTools/rules_distroless) repository.\n\nExamples can be found in the [GoogleContainerTools/rules_distroless](https://github.com/GoogleContainerTools/rules_distroless/tree/main/examples) repository.\n\n#### Examples with Bazel\n\nWe have some examples on how to run some common application stacks in the /examples directory.\nSee here for:\n\n- [Java](examples/java/BUILD)\n- [Python 3](examples/python3/BUILD)\n- [Go](examples/go/BUILD)\n- [Node.js](examples/nodejs/BUILD)\n\nSee here for examples on how to complete some common tasks in your image:\n\n- [Adding and running as a non-root user](examples/nonroot)\n- [Including Debian Packages](https://github.com/GoogleContainerTools/rules_distroless/blob/main/docs/apt.md)\n- [Including CA certificates](https://github.com/GoogleContainerTools/rules_distroless/blob/main/docs/rules.md#cacerts)\n\nSee here for more information on how these images are [built and released](RELEASES.md).\n\n### Base Operating System\n\nDistroless images are based on Debian 12 (bookworm). Images are explicitly tagged with Debian version suffixes (e.g. `-debian12`). Specifying an image without the distribution will currently select `-debian12` images, but that will change in the future to a newer version of Debian. It can be useful to reference the distribution explicitly, to prevent breaking builds when the next Debian version is released.\n\n### Operating System Updates for Security Fixes and CVEs\n\nDistroless tracks the upstream Debian releases, using [Github actions to automatically generate a pull request when there are updates](https://github.com/GoogleContainerTools/distroless/blob/main/.github/workflows/update-deb-package-snapshots.yml).\n\n### Debug Images\n\nDistroless images are minimal and lack shell access. The `:debug` image set for each language provides a busybox shell to enter.\n\nFor example:\n\n```sh\ncd examples/python3/\n```\n\nedit the `Dockerfile` to change the final image to `:debug`:\n\n```dockerfile\nFROM gcr.io/distroless/python3-debian12:debug\nCOPY . /app\nWORKDIR /app\nCMD [\"hello.py\", \"/etc\"]\n```\n\nthen build and launch with a shell entrypoint:\n\n```sh\ndocker build -t my_debug_image .\n```\n\n```sh\n$ docker run --entrypoint=sh -ti my_debug_image\n\n/app # ls\nBUILD       Dockerfile  hello.py\n```\n\n\u003e Note: If the image you are using already has a tag, for example `gcr.io/distroless/java17-debian12:nonroot`, use the tag `debug-\u003cexisting tag\u003e` instead, for example `gcr.io/distroless/java17-debian12:debug-nonroot`.\n\n\u003e Note: [ldd](http://man7.org/linux/man-pages/man1/ldd.1.html) is not installed in the base image as it's a shell script, you can copy it in or download it.\n\n### Who uses Distroless?\n\n- [Kubernetes](https://github.com/kubernetes/enhancements/blob/master/keps/sig-release/1729-rebase-images-to-distroless/README.md), since v1.15\n- [Knative](https://knative.dev)\n- [Tekton](https://tekton.dev)\n- [Teleport](https://goteleport.com)\n\nIf your project uses Distroless, send a PR to add your project here!\n\n## Community Discussion\n\n- [distroless-users Google Group](https://groups.google.com/forum/#!forum/distroless-users)\n- [Kubernetes slack #distroless channel](https://slack.k8s.io/)\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgooglecontainertools%2Fdistroless","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgooglecontainertools%2Fdistroless","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgooglecontainertools%2Fdistroless/lists"}