Develop Java applications. Includes the JDK and Java extensions.
| Metadata | Value |
|---|---|
| Categories | Core, Languages |
| Image type | Dockerfile |
| Published images | mcr.microsoft.com/devcontainers/java |
| Available image variants | 11 / 11-trixie, 17 /17-trixie, 21 / 21-trixie, 21-bookworm, 25 / 25-trixie, 25-bookworm, 17-bookworm, 11-bookworm (full list) |
| Published image architecture(s) | x86-64, arm64/aarch64 for bookworm, and bullseye variants |
| Container host OS support | Linux, macOS, Windows |
| Container OS | Debian |
| Languages, platforms | Java |
See history for information on the contents of published images.
You can directly reference pre-built versions of Dockerfile by using the image property in .devcontainer/devcontainer.json or updating the FROM statement in your own Dockerfile to one of the following. An example Dockerfile is included in this repository.
mcr.microsoft.com/devcontainers/java(latest)mcr.microsoft.com/devcontainers/java:25(or25-trixie,25-bookwormto pin to an OS version)mcr.microsoft.com/devcontainers/java:21(or21-trixie,21-bookwormto pin to an OS version)mcr.microsoft.com/devcontainers/java:11(or11-trixie,11-bookwormto pin to an OS version)mcr.microsoft.com/devcontainers/java:17(or17-trixie,17-bookwormto pin to an OS version)
Refer to this guide for more details.
You can decide how often you want updates by referencing a semantic version of each image. For example:
mcr.microsoft.com/devcontainers/java:3-11(or3-11-trixie,3-11-bookwormto pin to an OS version)mcr.microsoft.com/devcontainers/java:3.0-11(or3.0-11-trixie,3.0-11-bookwormto pin to an OS version)mcr.microsoft.com/devcontainers/java:3.0.5-11(or3.0.5-11-trixie,3.0.5-11-bookwormto pin to an OS version)
However, we only do security patching on the latest non-breaking, in support versions of images (e.g. 3-11). You may want to run apt-get update && apt-get upgrade in your Dockerfile if you lock to a more specific version to at least pick up OS security updates.
See history for information on the contents of each version and here for a complete list of available tags.
Alternatively, you can use the contents of .devcontainer to fully customize your container's contents or to build it for a container host architecture not supported by the image.
You can use the Java Feature to install maven and gradle in .devcontainer/devcontainer.json:
{
"features": {
"ghcr.io/devcontainers/features/java:1": {
"version": "none",
"installGradle": "true",
"installMaven": "true"
}
}
}Given JavaScript front-end web client code written for use in conjunction with a Java back-end often requires the use of Node.js-based utilities to build, this container also includes nvm so that you can easily install Node.js.
Also, you can use a Node feature to install any version of Node by adding the following to devcontainer.json:
{
"features": {
"ghcr.io/devcontainers/features/node:1": {
"version": "latest"
}
}
}Copyright (c) Microsoft Corporation. All rights reserved.
Licensed under the MIT License. See LICENSE.