Skip to content

Commit fa5fee8

Browse files
asanvaqalesancor1
andauthored
docs: migrate to v2 jre (#953)
* docs: migrate to v2 jre * docs: update run_conclusion * docs: update config wording * docs: add legacy information * docs: updates based on preview * docs: updating docs based on feedback --------- Co-authored-by: Alejandro Santisteban <alex.santisteban@canonical.com>
1 parent 0de7920 commit fa5fee8

1 file changed

Lines changed: 57 additions & 89 deletions

File tree

oci/jre/documentation.yaml

Lines changed: 57 additions & 89 deletions
Original file line numberDiff line numberDiff line change
@@ -1,61 +1,22 @@
1-
version: 1
2-
1+
version: 2
32
application: jre
4-
is_chiselled: true
53
description: |
6-
This image packs the Java Runtime Environment, coming
7-
from the [OpenJDK project](https://www.openjdk.org/), a free and open
4+
OpenJDK is the official reference implementation of Java Platform,
5+
Standard Edition (Java SE), since version 7. This image packs the Java
6+
Runtime Environment, coming from the
7+
[OpenJDK project](https://www.openjdk.org/), a free and open
88
source implementation of the Java Platform, Standard Edition (Java SE).
9-
OpenJDK is the official reference implementation of Java SE since
10-
version 7. [Read more](https://openjdk.org/).
9+
1110
Java is a registered trademark of Oracle and/or its affiliates.
12-
13-
## About Chiselled Ubuntu
14-
15-
This image does not include bash nor a package manager nor the OpenJDK.
16-
Its purpose is to serve as a runtime, final-stage base image for
17-
compatible Java applications.
18-
19-
Read more about chiselled Ubuntu for OpenJDK JRE, a new class of OCI images,
20-
on [the Ubuntu blog](https://ubuntu.com/blog/combining-distroless-and-ubuntu-chiselled-containers).
21-
And remember, the best base image is FROM scratch: so you could also
22-
[easily craft your own chiselled Ubuntu base](https://ubuntu.com/blog/craft-custom-chiselled-ubuntu-distroless)
23-
for your app specific needs.
24-
25-
Please note that the Ubuntu 22.04 JRE images are Dockerfile-base
26-
images, whereas from Ubuntu 24.04 onward the images
27-
are now rocks. As such the entrypoint is now Pebble. Read more on the
28-
[Rockcraft docs](https://canonical-rockcraft.readthedocs-hosted.com/en/latest/explanation/rocks/).
29-
30-
Ubuntu 22.04 JRE images have `java` as the entrypoint.
31-
32-
```bash
33-
$ docker run --rm ubuntu/jre:17_edge
34-
Usage: java [options] <mainclass> [args...]
35-
```
36-
37-
Ubuntu 24.04 JRE images have `pebble enter`
38-
as the entrypoint. You can access the `java` with the following
39-
command:
40-
41-
```bash
42-
$ docker run --rm ubuntu/jre:21_edge exec java
43-
Usage: java [options] <mainclass> [args...]
44-
...
45-
```
46-
Note: The official OpenJDK 25 JRE image includes java.compiler and
47-
jdk.compiler modules. Therefore, the chiseled image can run .java files.
11+
website: https://openjdk.org
12+
issues: https://github.com/canonical/jre-rock/issues
13+
source-code: https://github.com/canonical/jdk-rock
4814

4915
docker:
50-
parameters:
51-
- --rm
52-
access: |
53-
For Ubuntu 24.04 JRE
54-
55-
```bash
56-
docker run --rm --name jre-container -e TZ=UTC ubuntu/jre:21-24.04_edge exec java
57-
```
58-
16+
run_cmd: exec java
17+
parameters: >-
18+
--rm
19+
run_conclusion: |
5920
The container logs will simply show the OpenJRE help message.
6021
This is because the container expects a compiled Java application to be given.
6122
@@ -72,29 +33,10 @@ docker:
7233
}
7334
}
7435
```
75-
7636
You can build and package the above Hello World application with
77-
chiselled Ubuntu 22.04 JRE 8 and 17 using the following example
37+
chiselled Ubuntu 24.04 using the following example
7838
Dockerfile.
7939
80-
```docker
81-
FROM ubuntu:22.04 AS builder
82-
RUN apt-get update && apt-get install -y openjdk-8-jdk
83-
WORKDIR /app
84-
ADD HelloWorld.java .
85-
86-
RUN javac -source 8 -target 8 HelloWorld.java -d .
87-
88-
FROM ubuntu/jre:8-22.04_edge
89-
90-
WORKDIR /
91-
COPY --from=builder /app/HelloWorld.class .
92-
93-
CMD [ "HelloWorld" ]
94-
```
95-
96-
For Ubuntu 24.04 please use
97-
9840
```docker
9941
FROM ubuntu:24.04 AS builder
10042
RUN apt-get update && apt-get install -y openjdk-8-jdk
@@ -110,26 +52,52 @@ docker:
11052
CMD [ "exec", "java", "-cp", "/", "HelloWorld" ]
11153
```
11254
55+
legacy:
56+
parameters: >-
57+
--rm
58+
run_conclusion: |
59+
The Ubuntu 22.04 JRE images are Dockerfile-based images.
60+
61+
You can build and package the above Hello World application with
62+
chiselled Ubuntu 22.04 JRE 8 and 17 using the following example
63+
Dockerfile.
64+
65+
```docker
66+
FROM ubuntu:22.04 AS builder
67+
RUN apt-get update && apt-get install -y openjdk-8-jdk
68+
WORKDIR /app
69+
ADD HelloWorld.java .
70+
71+
RUN javac -source 8 -target 8 HelloWorld.java -d .
72+
73+
FROM ubuntu/jre:8-22.04_edge
74+
75+
WORKDIR /
76+
COPY --from=builder /app/HelloWorld.class .
77+
78+
CMD [ "HelloWorld" ]
79+
java [options] <mainclass> [args...]
80+
...
81+
```
82+
83+
config:
84+
TZ:
85+
type: env
86+
description: Configures the timezone value for Java process execution.
87+
'`-v <host-path>:/app`':
88+
type: mount
89+
description: Configure with a host mount to provide compiled classes or application files.
90+
'`exec java <args>`':
91+
type: app
92+
description: Execute with Java command arguments or classpath options.
93+
'`--rm`':
94+
type: other
95+
description: Run with automatic container cleanup after exit.
96+
11397
override_tracks:
11498
# Tracks release from legacy repo
115-
#(https://github.com/rockcrafters/chiselled-jre/)
99+
# (https://github.com/rockcrafters/chiselled-jre/)
116100
8-22.04:
117101
end-of-life: "2027-06-01T00:00:00Z"
118102
17-22.04:
119103
end-of-life: "2027-06-01T00:00:00Z"
120-
121-
debug:
122-
text: |
123-
### Debugging
124-
125-
To debug the container:
126-
127-
```bash
128-
docker logs -f openjdk-jre-container
129-
```
130-
131-
For Ubuntu 24.04 JRE, to inspect application logs:
132-
133-
```bash
134-
docker exec openjdk-jre-container pebble logs
135-
```

0 commit comments

Comments
 (0)