{"id":15069472,"url":"https://github.com/googlecloudplatform/openjdk-runtime","last_synced_at":"2025-10-20T01:30:59.623Z","repository":{"id":45316748,"uuid":"66016292","full_name":"GoogleCloudPlatform/openjdk-runtime","owner":"GoogleCloudPlatform","description":"Google Cloud Platform OpenJDK Docker image","archived":true,"fork":false,"pushed_at":"2024-12-12T17:11:56.000Z","size":2952,"stargazers_count":62,"open_issues_count":35,"forks_count":41,"subscribers_count":38,"default_branch":"master","last_synced_at":"2024-12-18T08:41:11.780Z","etag":null,"topics":["app-engine","cloud","docker","gcp","google","java","openjdk","runtime"],"latest_commit_sha":null,"homepage":"","language":"Shell","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/GoogleCloudPlatform.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":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2016-08-18T17:13:04.000Z","updated_at":"2024-12-12T19:02:24.000Z","dependencies_parsed_at":"2024-09-25T01:42:49.307Z","dependency_job_id":"149cbb97-1a89-4e1e-a06c-85c7e77b0624","html_url":"https://github.com/GoogleCloudPlatform/openjdk-runtime","commit_stats":null,"previous_names":[],"tags_count":29,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GoogleCloudPlatform%2Fopenjdk-runtime","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GoogleCloudPlatform%2Fopenjdk-runtime/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GoogleCloudPlatform%2Fopenjdk-runtime/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GoogleCloudPlatform%2Fopenjdk-runtime/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/GoogleCloudPlatform","download_url":"https://codeload.github.com/GoogleCloudPlatform/openjdk-runtime/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":237243005,"owners_count":19278060,"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":["app-engine","cloud","docker","gcp","google","java","openjdk","runtime"],"created_at":"2024-09-25T01:42:42.145Z","updated_at":"2025-10-20T01:30:59.290Z","avatar_url":"https://github.com/GoogleCloudPlatform.png","language":"Shell","readme":"\n# Google Cloud Platform OpenJDK Docker Image\n\nThis repository contains the source for the Google-maintained OpenJDK [docker](https://docker.com) image. This image can be used as the base image for running Java applications on [Google App Engine Flexible Environment](https://cloud.google.com/appengine/docs/flexible/java/) and [Google Kubernetes Engine](https://cloud.google.com/kubernetes-engine).\n\n## Repository/Tag Details\nSupported images/tags include:\n* `gcr.io/google-appengine/openjdk:8`\n\n## App Engine Flexible Environment\nWhen using App Engine Flexible, you can use the runtime without worrying about Docker by specifying `runtime: java` in your `app.yaml`:\n```yaml\nruntime: java\nenv: flex\n```\nThe runtime image `gcr.io/google-appenine/openjdk:8` will be automatically selected if you are attempting to deploy a JAR (`*.jar` file).\n\nTo select a jdk version, use the `runtime_config.jdk` field in app.yaml. Supported JDK versions include `openjdk8` and `openjdk11`.\n```yaml\nruntime: java\nenv: flex\nruntime_config:\n  jdk: openjdk8\n```\n\nIf you want to use the image as a base for a custom runtime, you can specify `runtime: custom` in your `app.yaml` and then\nwrite the Dockerfile like this:\n\n```dockerfile\nFROM gcr.io/google-appengine/openjdk\nCOPY your-application.jar $APP_DESTINATION\n```\n\nThat will add the JAR in the correct location for the Docker container.\n\nOnce you have this configuration, you can use the Google Cloud SDK to deploy this directory containing the 2 configuration files and the JAR using:\n```\ngcloud app deploy app.yaml\n```\n\n## Kubernetes Engine \u0026 other Docker hosts\nFor other Docker hosts, you'll need to create a Dockerfile based on this image that copies your application code and installs dependencies. For example:\n\n```dockerfile\nFROM gcr.io/google-appengine/openjdk\nCOPY your-application.jar $APP_DESTINATION\n```\nYou can then build the docker container using `docker build` or [Google Cloud Container Builder](https://cloud.google.com/container-builder/docs/).\nBy default, the CMD is set to run the application JAR. You can change this by specifying your own `CMD` or `ENTRYPOINT`.\n\n### Container Memory Limits\nThe runtime will try to detect the container memory limit by looking at the `/sys/fs/cgroup/memory/memory.limit_in_bytes`  file, which is automatically mounted by Docker. However, this may not work with other container runtimes. In those cases, to help the runtime compute accurate JVM memory defaults when running on Kubernetes, you can indicate memory limit through the [Downward API](https://kubernetes.io/docs/tasks/configure-pod-container/environment-variable-expose-pod-information).\n\nTo do so add an environment variable named `KUBERNETES_MEMORY_LIMIT` *(This name is subject to change)* with the value `limits.memory` and the name of your container.\nFor example:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: dapi-envars-resourcefieldref\nspec:\n  containers:\n    - name: java-kubernetes-container\n      image: gcr.io/google-appengine/openjdk\n      resources:\n        requests:\n          memory: \"32Mi\"\n        limits:\n          memory: \"64Mi\"\n      env:\n        - name: KUBERNETES_MEMORY_LIMIT\n          valueFrom:\n            resourceFieldRef:\n              containerName: java-kubernetes-container\n              resource: limits.memory\n```\n\n## The Default Entry Point\nAny arguments passed to the entry point that are not executable are treated as arguments to the java command:\n```\n$ docker run openjdk -jar /usr/share/someapplication.jar\n```\n\nAny arguments passed to the entry point that are executable replace the default command, thus a shell could\nbe run with:\n```\n\u003e docker run -it --rm openjdk bash\nroot@c7b35e88ff93:/# \n```\n\n## Entry Point Features\nThe entry point for the openjdk8 image is [docker-entrypoint.bash](https://github.com/GoogleCloudPlatform/openjdk-runtime/blob/master/openjdk-common/src/main/docker/docker-entrypoint.bash), which does the processing of the passed command line arguments to look for an executable alternative or arguments to the default command (java).\n\nIf the default command (java) is used, then the entry point sources the [setup-env.d/](https://github.com/GoogleCloudPlatform/openjdk-runtime/tree/master/openjdk-common/src/main/docker/setup-env.d), which looks for supported features to be enabled and/or configured.  The following table indicates the environment variables that may be used to enable/disable/configure features, any default values if they are not set:\n\n|Env Var                             | Description         | Type     | Default                                     |\n|------------------------------------|---------------------|----------|---------------------------------------------|\n|`PROFILER_ENABLE`                   | Stackdriver Profiler| boolean  | `false`                                     |\n|`TMPDIR`                            | Temporary Directory | dirname  |                                             |\n|`JAVA_TMP_OPTS`                     | JVM tmpdir args     | JVM args | `-Djava.io.tmpdir=${TMPDIR}`                |\n|`GAE_MEMORY_MB`                     | Available memory    | size     | Set by GAE or `/proc/meminfo`-400M          |\n|`HEAP_SIZE_RATIO`                   | Memory for the heap | percent  | 80                                          |\n|`HEAP_SIZE_MB`                      | Available heap      | size     | `${HEAP_SIZE_RATIO}`% of `${GAE_MEMORY_MB}` |\n|`JAVA_HEAP_OPTS`                    | JVM heap args       | JVM args | `-Xms${HEAP_SIZE_MB}M -Xmx${HEAP_SIZE_MB}M` |\n|`JAVA_GC_OPTS`                      | JVM GC args         | JVM args | `-XX:+UseG1GC` plus configuration           |\n|`JAVA_USER_OPTS`                    | JVM other args      | JVM args |                                             |\n|`JAVA_OPTS`                         | JVM args            | JVM args | See below                                   |\n|`SHUTDOWN_LOGGING_THREAD_DUMP`      | Shutdown thread dump| boolean  | `false`                                     |\n|`SHUTDOWN_LOGGING_HEAP_INFO`        | Shutdown heap info  | boolean  | `false`                                     |\n|`SHUTDOWN_LOGGING_SAMPLE_THRESHOLD` | Shutdown sampling   | percent  | 100                                         |\n\nIf not explicitly set, `JAVA_OPTS` is defaulted to \n```\nJAVA_OPTS:=-showversion \\\n           ${JAVA_TMP_OPTS} \\\n           ${PROFILER_AGENT} \\\n           ${JAVA_HEAP_OPTS} \\\n           ${JAVA_GC_OPTS} \\\n           ${JAVA_USER_OPTS}\n```\n\nThe command line executed is effectively (where $@ are the args passed into the docker entry point):\n```\njava $JAVA_OPTS \"$@\"\n```\n\n### JVM Shutdown Diagnostics\n\nThis feature is not enabled by default.\n\nSometimes it's necessary to obtain diagnostic information when the JVM is stopped using `SIGTERM` or `docker stop`.\nThis may happen on App Engine flexible environment, when the autohealer decides to kill unhealthy VMs that have\nan app that is unresponsive due to a deadlock or high load and stopped returning requests, including health checks.\n\nTo help diagnose such situations the runtime provides support for outputting a thread dump and/or\nheap info upon JVM shutdown forced by the `TERM` signal.\n\nThe following environment variables should be used to enable app container shutdown reporting (must be set to `true` or `false`):\n\n`SHUTDOWN_LOGGING_THREAD_DUMP` - output thread dump\n\n`SHUTDOWN_LOGGING_HEAP_INFO` - output heap information\n\nIf enabled, the runtime provides a wrapper for the JVM that traps `SIGTERM`, and runs debugging tools on the JVM\nto emit the thread dump and heap information to stdout.\n\nIf you're running many VMs, sampling is supported by using the environment variable `SHUTDOWN_LOGGING_SAMPLE_THRESHOLD`\nwhich is an integer between 0 and 100. 0 means no VMs report logs, 100 means all VMs report logs.\n(If this env var is not set, we default to reporting for all VMs).\n\n## The Default Command\nThe default command will attempt to run `app.jar` in the current working directory.\nIt's equivalent to:\n```\n$ docker run openjdk java -jar app.jar\nError: Unable to access jarfile app.jar\n```\nThe error is normal because the default command is designed for child containers that have a Dockerfile definition like this:\n```\nFROM openjdk\nADD my_app_0.0.1.jar app.jar\n```\n# Development Guide\n\n* See [instructions](DEVELOPING.md) on how to build and test this image.\n\n# Contributing changes\n\n* See [CONTRIBUTING.md](CONTRIBUTING.md)\n\n## Licensing\n\n* See [LICENSE.md](LICENSE)\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgooglecloudplatform%2Fopenjdk-runtime","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgooglecloudplatform%2Fopenjdk-runtime","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgooglecloudplatform%2Fopenjdk-runtime/lists"}