Skip to content

Commit ac1cab4

Browse files
authored
Merge pull request #24 from redhat-scholars/containerfile
rename dockerfile to containerfile
2 parents c0c51d7 + 6f03cb9 commit ac1cab4

10 files changed

+91
-94
lines changed
Loading
Loading

documentation/modules/ROOT/nav.adoc

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
** xref:setup.adoc[Setup]
33
44
* I. Basics
5-
** xref:dockerfile.adoc[Dockerfile]
5+
** xref:containerfile.adoc[Containerfile]
66
** xref:imagemanagement.adoc[Image management]
77
** xref:runningcontainers.adoc[Running containers]
88
** xref:ports.adoc[Ports]

documentation/modules/ROOT/pages/dockerfile.adoc documentation/modules/ROOT/pages/containerfile.adoc

+16-10
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
:project-name: tutorial-app
44

5-
A https://docs.docker.com/engine/reference/builder/[Dockerfile] is where you'll estabilish the definitions used to build a container image. It uses three main keywords/commands:
5+
A Containerfile, also known as a Dockerfile, is where you'll establish the definitions used to build a container image. It uses three main keywords/commands:
66

77
* FROM: where you'll inform the base image used to build your own image
88
* COPY: where you'll add resources (files) to your image
@@ -44,22 +44,28 @@ mvn package
4444
----
4545

4646

47-
== Building a Dockerfile
47+
== Building a Containerfile
4848

49-
Create a file named Dockerfile.
49+
Create a file named Containerfile.
5050

5151
[.console-input]
5252
[source,bash,subs="+macros,+attributes"]
5353
----
54-
cat <<EOF >Dockerfile
55-
FROM registry.access.redhat.com/ubi8/openjdk-17
54+
cat <<EOF >Containerfile
55+
FROM registry.access.redhat.com/ubi9/openjdk-21-runtime:1.18-4
5656
57-
COPY target/quarkus-app/lib/ /deployments/lib/
58-
COPY target/quarkus-app/quarkus-run.jar /deployments/app.jar
59-
COPY target/quarkus-app/app/ /deployments/app/
60-
COPY target/quarkus-app/quarkus/ /deployments/quarkus/
57+
ENV LANGUAGE='en_US:en'
58+
59+
COPY --chown=185 target/quarkus-app/lib/ /deployments/lib/
60+
COPY --chown=185 target/quarkus-app/*.jar /deployments/
61+
COPY --chown=185 target/quarkus-app/app/ /deployments/app/
62+
COPY --chown=185 target/quarkus-app/quarkus/ /deployments/quarkus/
63+
64+
EXPOSE 8080
65+
USER 185
66+
ENV JAVA_OPTS="-Djava.util.logging.manager=org.jboss.logmanager.LogManager"
67+
ENV JAVA_APP_JAR="/deployments/quarkus-run.jar"
6168
62-
CMD ["java", "-jar", "/deployments/app.jar"]
6369
EOF
6470
----
6571

documentation/modules/ROOT/pages/env.adoc

+16-10
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
= Environment variables
22

3-
Environment variables keep your app secure, flexible and organized. Let's take a look at how to pass enviroment variables to containers.
3+
Environment variables keep your app secure, flexible and organized. Let's take a look at how to pass environment variables to containers.
44

55
== Using an environment variable with your container
66

@@ -96,21 +96,27 @@ no config
9696

9797
The `no config` output happens because we didn't really create the environment variable. Let's fix it.
9898

99-
Edit your Dockerfile like this:
99+
Edit your Containerfile like this (or simply add the `ENV config=dockerfile` line):
100100

101101
[.console-input]
102102
[source,docker,subs="+macros,+attributes"]
103103
----
104-
FROM registry.access.redhat.com/ubi8/openjdk-17
104+
FROM registry.access.redhat.com/ubi9/openjdk-21-runtime:1.18-4
105105
106-
COPY target/quarkus-app/lib/ /deployments/lib/
107-
COPY target/quarkus-app/*.jar /deployments/app.jar
108-
COPY target/quarkus-app/app/ /deployments/app/
109-
COPY target/quarkus-app/quarkus/ /deployments/quarkus/
106+
ENV LANGUAGE='en_US:en'
110107
111-
ENV config=dockerfile
108+
COPY --chown=185 target/quarkus-app/lib/ /deployments/lib/
109+
COPY --chown=185 target/quarkus-app/*.jar /deployments/
110+
COPY --chown=185 target/quarkus-app/app/ /deployments/app/
111+
COPY --chown=185 target/quarkus-app/quarkus/ /deployments/quarkus/
112+
113+
EXPOSE 8080
114+
USER 185
115+
ENV JAVA_OPTS="-Djava.util.logging.manager=org.jboss.logmanager.LogManager"
116+
ENV JAVA_APP_JAR="/deployments/quarkus-run.jar"
117+
118+
ENV config=containerfile
112119
113-
CMD ["java", "-jar", "/deployments/app.jar"]
114120
----
115121

116122
Let's rebuild our image, re-create the container and call it again:
@@ -129,7 +135,7 @@ Now your output is:
129135
[.console-output]
130136
[source,text]
131137
----
132-
dockerfile
138+
containerfile
133139
----
134140

135141
Finally, let's replace the variable's content. First we remove the container:

documentation/modules/ROOT/pages/imagemanagement.adoc

+37-50
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22

33
An image can be used to create and run containers. It is like a template, containing instructions on how to build the container. Images are the starting point for any container related activity, and can be thought of as a snapshot in a virtual machine (VM) environment.
44

5-
== Building an image based on a Dockerfile
5+
== Building an image based on a Containerfile (aka Dockerfile)
66

7-
With the Dockerfile that we created in the last step, let's build a container image:
7+
With the Containerfile that we created in the last step, let's build a container image:
88

99
[.console-input]
1010
[source,bash,subs="+macros,+attributes"]
@@ -17,25 +17,31 @@ You'll see an output like this:
1717
[.console-output]
1818
[source,text]
1919
----
20-
Sending build context to Docker daemon 10.95MB
21-
Step 1/4 : FROM registry.access.redhat.com/ubi8/openjdk-11
22-
latest: Pulling from ubi8/openjdk-11
23-
396754cf27f9: Pull complete
24-
41e1474940d5: Pull complete
25-
fe52369f78c0: Pull complete
26-
Digest: sha256:98c69a5b81bca0fe331100390c7357c69fd137e8a6228300eda820a0893a1be0
27-
Status: Downloaded newer image for registry.access.redhat.com/ubi8/openjdk-11:latest
28-
---> e502114b0d20
29-
Step 2/4 : ADD target/lib/* /deployments/lib/
30-
---> 47e879f30cec
31-
Step 3/4 : ADD target/*-runner.jar /deployments/app.jar
32-
---> 393bbade30ae
33-
Step 4/4 : CMD ["java", "-jar", "/deployments/app.jar"]
34-
---> Running in d09c7708954d
35-
Removing intermediate container d09c7708954d
36-
---> 87776d35fc85
37-
Successfully built 87776d35fc85
38-
Successfully tagged my-image:latest
20+
STEP 1/11: FROM registry.access.redhat.com/ubi9/openjdk-21-runtime:1.18-4
21+
STEP 2/11: ENV LANGUAGE='en_US:en'
22+
--> Using cache 7819ee5ffcddd7271987e306c787854c874bc81798370435d6efa7a89cc4990e
23+
--> 7819ee5ffcdd
24+
STEP 3/11: COPY --chown=185 target/quarkus-app/lib/ /deployments/lib/
25+
--> 9b51381ccca6
26+
STEP 4/11: COPY --chown=185 target/quarkus-app/*.jar /deployments/
27+
--> 4d299e6fd3b4
28+
STEP 5/11: COPY --chown=185 target/quarkus-app/app/ /deployments/app/
29+
--> 6fce0c1e1dbc
30+
STEP 6/11: COPY --chown=185 target/quarkus-app/quarkus/ /deployments/quarkus/
31+
--> 7177bec47b2f
32+
STEP 7/11: EXPOSE 8080
33+
--> 9bd1b9ec7771
34+
STEP 8/11: USER 185
35+
--> 61bc6e589684
36+
STEP 9/11: ENV JAVA_OPTS="-Djava.util.logging.manager=org.jboss.logmanager.LogManager"
37+
--> 08f8fe193e07
38+
STEP 10/11: ENV JAVA_APP_JAR="/deployments/quarkus-run.jar"
39+
--> 2f8f931e08b1
40+
STEP 11/11: CMD ["java", "-jar", "/deployments/app.jar"]
41+
COMMIT my-image
42+
--> a8172ead99ee
43+
Successfully tagged localhost/my-image:latest
44+
a8172ead99eece385fa756e85948656896645f7f1848c68dfe498da9d93be073
3945
----
4046

4147
== Listing the available images
@@ -54,11 +60,11 @@ You'll see at least these two outputs:
5460
[source,text]
5561
----
5662
REPOSITORY TAG IMAGE ID CREATED SIZE
57-
my-image latest 87776d35fc85 4 minutes ago 516MB
58-
registry.access.redhat.com/ubi8/openjdk-11 latest e502114b0d20 2 months ago 505MB
63+
my-image latest 87776d35fc85 4 minutes ago 392MB
64+
registry.access.redhat.com/ubi9/openjdk-21-runtime 1.18-4 80786be7434f 3 weeks ago 375 MB
5965
----
6066

61-
Your image is the `my-image` and the `registry.access.redhat.com/ubi8/openjdk-11` is the image used to build yours.
67+
Your image is the `my-image` and the `registry.access.redhat.com/ubi9/openjdk-21` is the image used to build yours.
6268

6369
== Removing images
6470

@@ -70,36 +76,17 @@ To remove your just created image:
7076
docker image rm my-image
7177
----
7278

73-
// == Exploring the Desktop interfaces
79+
== Exploring the Desktop interface
7480

75-
// Let's take a look at image management in the Desktop interfaces.
81+
Let's take a look at image management in the Desktop interfaces.
7682

77-
// [tabs]
78-
// ====
79-
// Docker Desktop::
80-
// +
81-
// --
82-
// Using Docker Desktop, we can see our newly created image in the *Images* tab. Here, we have information about the newly created image, including the the image ID, tag, creation date, and size of the image. Let's select the image name to see more information about the image.
8383

84-
// image::docker-desktop-images.png[alt="Docker Desktop Images tab", align="center"]
84+
Podman Desktop::
8585

86-
// Here, we see information about the image hierarchy, as well as the various layers added, any vulnerabilities that may exist, and packages added.
86+
With Podman Desktop, we can see our newly created image in the *Images* tab. We can find information about the newly created image, including the the image ID, tag, creation date, and size of the image. Let's select the image name to see more information about the image.
8787

88-
// image::docker-desktop-image-info.png[alt="Docker Desktop Image Info tab", align="center"]
88+
image::podman-desktop-images.png[alt="Podman Desktop Images tab", align="center"]
8989

90-
// Returning back to the Images tab, we could also use the *Hub* tab to see our images that have been published to Docker Hub.
90+
We can see information about the image layers, and low-level information about the image in JSON format.
9191

92-
// image::docker-desktop-hub.png[alt="Docker Desktop Hub tab", align="center"]
93-
// --
94-
// Podman Desktop::
95-
// +
96-
// --
97-
// With Podman Desktop, we can see our newly created image in the *Images* tab. Here, we have information about the newly created image, including the the image ID, tag, creation date, and size of the image. Let's select the image name to see more information about the image.
98-
99-
// image::podman-desktop-images.png[alt="Podman Desktop Images tab", align="center"]
100-
101-
// Here, we see information about the image layers, and low-level information about the image in JSON format.
102-
103-
// image::podman-desktop-image-info.png[alt="Podman Desktop Image Info tab", align="center"]
104-
// --
105-
// ====
92+
image::podman-desktop-image-info.png[alt="Podman Desktop Image Info tab", align="center"]

documentation/modules/ROOT/pages/ports.adoc

+2-2
Original file line numberDiff line numberDiff line change
@@ -54,12 +54,12 @@ Let's try to reach the application again:
5454
curl localhost:8080/hello
5555
----
5656

57-
You now got this output:
57+
You should now see output like this:
5858

5959
[.console-output]
6060
[source,text]
6161
----
62-
hello
62+
Hello from Quarkus REST
6363
----
6464

6565
This means that your application is now accessible!

documentation/modules/ROOT/pages/pushing.adoc

+5-5
Original file line numberDiff line numberDiff line change
@@ -54,27 +54,27 @@ It's now ready to be pushed. Before doing it, you just need to login into your r
5454

5555
[tabs]
5656
====
57-
Docker Hub::
57+
Quay.io::
5858
+
5959
--
6060
[.console-input]
6161
[source,bash,subs="+macros,+attributes"]
6262
----
63-
docker login
63+
docker login quay.io
6464
----
6565
--
66-
Quay.io::
66+
Docker Hub::
6767
+
6868
--
6969
[.console-input]
7070
[source,bash,subs="+macros,+attributes"]
7171
----
72-
docker login quay.io
72+
docker login
7373
----
7474
--
7575
====
7676

77-
And finally you can push it:
77+
And finally you can push it, eg.:
7878

7979
[.console-input]
8080
[source,bash,subs="+macros,+attributes"]

documentation/modules/ROOT/pages/runningcontainers.adoc

+9-7
Original file line numberDiff line numberDiff line change
@@ -127,13 +127,15 @@ You now got an output like this:
127127
[.console-output]
128128
[source,text]
129129
----
130-
__ ____ __ _____ ___ __ ____ ______
131-
--/ __ \/ / / / _ | / _ \/ //_/ / / / __/
132-
-/ /_/ / /_/ / __ |/ , _/ ,< / /_/ /\ \
133-
--\___\_\____/_/ |_/_/|_/_/|_|\____/___/
134-
2020-10-07 18:36:05,081 INFO [io.quarkus] (main) tutorial-app 1.0-SNAPSHOT on JVM (powered by Quarkus 1.8.2.Final) started in 0.651s. Listening on: http://0.0.0.0:8080
135-
2020-10-07 18:36:05,105 INFO [io.quarkus] (main) Profile prod activated.
136-
2020-10-07 18:36:05,105 INFO [io.quarkus] (main) Installed features: [cdi, resteasy]
130+
INFO exec -a "java" java -Djava.util.logging.manager=org.jboss.logmanager.LogManager -cp "." -jar /deployments/quarkus-run.jar
131+
INFO running in /deployments
132+
__ ____ __ _____ ___ __ ____ ______
133+
--/ __ \/ / / / _ | / _ \/ //_/ / / / __/
134+
-/ /_/ / /_/ / __ |/ , _/ ,< / /_/ /\ \
135+
--\___\_\____/_/ |_/_/|_/_/|_|\____/___/
136+
2024-05-22 10:53:37,988 INFO [io.quarkus] (main) tutorial-app 1.0.0-SNAPSHOT on JVM (powered by Quarkus 3.10.1) started in 0.455s. Listening on: http://0.0.0.0:8080
137+
2024-05-22 10:53:37,989 INFO [io.quarkus] (main) Profile prod activated.
138+
2024-05-22 10:53:37,989 INFO [io.quarkus] (main) Installed features: [cdi, rest, smallrye-context-propagation, vertx]
137139
----
138140

139141
Notice that your terminal is attached to the container process. If you use `CTRL+C`, the container will stop.

documentation/modules/ROOT/pages/setup.adoc

+5-9
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,11 @@ TIP: By default, the commands in this tutorial are using Docker, but you use `po
1212
|===
1313
|**Tool**|**macOS**|**Fedora**|**Windows**
1414

15-
| **Docker**
16-
| https://docs.docker.com/desktop/install/mac-install/[Docker Desktop for Mac, window="_blank"]
17-
| `dnf install docker`
18-
| https://docs.docker.com/desktop/install/windows-install/[Docker Desktop for Windows, window="_blank"]
19-
20-
| **Podman**
21-
| https://www.docker.com/products/docker-desktop[Podman Desktop for Mac, window="_blank"]
22-
| `dnf install podman`
23-
| https://podman-desktop.io/docs/Installation/windows-install[Podman Desktop for Windows, window="_blank"]
15+
16+
| **Podman Desktop**
17+
| https://podman-desktop.io/downloads[Podman Desktop for Mac, window="_blank"]
18+
| https://podman-desktop.io/downloads[Podman Desktop for Linux, window="_blank"]
19+
| https://podman-desktop.io/downloads[Podman Desktop for Windows, window="_blank"]
2420

2521
| **Java 17**
2622
| `brew tap AdoptOpenJDK/openjdk && brew cask install adoptopenjdk17`

0 commit comments

Comments
 (0)