diff --git a/bin/build-site.sh b/bin/build-site.sh index fb219ea..4c71a3c 100755 --- a/bin/build-site.sh +++ b/bin/build-site.sh @@ -1,2 +1,2 @@ #!/bin/sh -docker run -u $(id -u) -v $PWD:/antora:Z --rm -t antora/antora:2.3.1 --cache-dir=./.cache/antora site.yml +podman run -u $(id -u) -v $PWD:/antora:Z --rm -t antora/antora:2.3.1 --cache-dir=./.cache/antora site.yml diff --git a/documentation/antora.yml b/documentation/antora.yml index 65517ae..6f2e8da 100644 --- a/documentation/antora.yml +++ b/documentation/antora.yml @@ -1,7 +1,8 @@ name: containers-tutorial title: Containers Tutorial -version: master -display_version: v1.0 +version: podman +display_version: v1.5 +prerelease: true nav: - modules/ROOT/nav.adoc diff --git a/documentation/modules/ROOT/assets/images/podman-desktop-pod-play.png b/documentation/modules/ROOT/assets/images/podman-desktop-pod-play.png index 20ce5bc..81bfa03 100644 Binary files a/documentation/modules/ROOT/assets/images/podman-desktop-pod-play.png and b/documentation/modules/ROOT/assets/images/podman-desktop-pod-play.png differ diff --git a/documentation/modules/ROOT/pages/buildah.adoc b/documentation/modules/ROOT/pages/buildah.adoc index 0d96d14..de90457 100644 --- a/documentation/modules/ROOT/pages/buildah.adoc +++ b/documentation/modules/ROOT/pages/buildah.adoc @@ -14,7 +14,7 @@ In a terminal window, start the container having `buildah` installed: [.console-input] [source,bash,subs="+macros,+attributes"] ---- -docker run -it --device /dev/fuse:rw --security-opt seccomp=unconfined --security-opt apparmor=unconfined quay.io/buildah/stable:latest bash +podman run -it --device /dev/fuse:rw --security-opt seccomp=unconfined --security-opt apparmor=unconfined quay.io/buildah/stable:latest bash ---- == Creating a Container Image diff --git a/documentation/modules/ROOT/pages/env.adoc b/documentation/modules/ROOT/pages/env.adoc index ba28fce..495d42c 100644 --- a/documentation/modules/ROOT/pages/env.adoc +++ b/documentation/modules/ROOT/pages/env.adoc @@ -29,7 +29,7 @@ import jakarta.ws.rs.Produces; import jakarta.ws.rs.core.MediaType; @Path("/hello") -public class HelloResource { +public class GreetingResource { @ConfigProperty(name = "config") Optional config; @@ -59,7 +59,7 @@ Rebuild our image to get the new version of the application: [.console-input] [source,bash,subs="+macros,+attributes"] ---- -docker build -t my-image . +podman build -t my-image . ---- Remove your running container: @@ -67,7 +67,7 @@ Remove your running container: [.console-input] [source,bash,subs="+macros,+attributes"] ---- -docker rm -f my-container +podman rm -f my-container ---- And run the new one: @@ -75,7 +75,7 @@ And run the new one: [.console-input] [source,bash,subs="+macros,+attributes"] ---- -docker run -d --name my-container -p 8080:8080 my-image +podman run -d --name my-container -p 8080:8080 my-image ---- Now let's call the application: @@ -124,9 +124,9 @@ Let's rebuild our image, re-create the container and call it again: [.console-input] [source,bash,subs="+macros,+attributes"] ---- -docker build -t my-image . -docker rm -f my-container -docker run -d --name my-container -p 8080:8080 my-image +podman build -t my-image . +podman rm -f my-container +podman run -d --name my-container -p 8080:8080 my-image curl localhost:8080/hello ---- @@ -143,7 +143,7 @@ Finally, let's replace the variable's content. First we remove the container: [.console-input] [source,bash,subs="+macros,+attributes"] ---- -docker rm -f my-container +podman rm -f my-container ---- And then we re-create it passing a new value for the environment variable: @@ -151,7 +151,7 @@ And then we re-create it passing a new value for the environment variable: [.console-input] [source,bash,subs="+macros,+attributes"] ---- -docker run -d --name my-container -p 8080:8080 -e config=container my-image +podman run -d --name my-container -p 8080:8080 -e config=container my-image ---- Then we call the application again: diff --git a/documentation/modules/ROOT/pages/imagemanagement.adoc b/documentation/modules/ROOT/pages/imagemanagement.adoc index 1b2776a..a1d1e8f 100644 --- a/documentation/modules/ROOT/pages/imagemanagement.adoc +++ b/documentation/modules/ROOT/pages/imagemanagement.adoc @@ -9,7 +9,7 @@ With the Containerfile that we created in the last step, let's build a container [.console-input] [source,bash,subs="+macros,+attributes"] ---- -docker build -t my-image . +podman build -t my-image . ---- You'll see an output like this: @@ -51,7 +51,7 @@ To see your just created image, just run: [.console-input] [source,bash,subs="+macros,+attributes"] ---- -docker image list +podman image list ---- You'll see at least these two outputs: @@ -66,6 +66,16 @@ registry.access.redhat.com/ubi9/openjdk-21-runtime 1.18-4 80786be7434f Your image is the `my-image` and the `registry.access.redhat.com/ubi9/openjdk-21` is the image used to build yours. +== Removing images + +To remove your just created image: + +[.console-input] +[source,bash,subs="+macros,+attributes"] +---- +podman image rm my-image +---- + == Exploring the Desktop interface Let's take a look at image management in the Desktop interfaces. @@ -91,7 +101,7 @@ The Podman or Docker CLI offer many ways to manage container images. You can fin [.console-input] [source,bash,subs="+macros,+attributes"] ---- -docker image -h +podman image -h ---- [.console-output] @@ -135,7 +145,7 @@ Let's try to remove your just created image: [.console-input] [source,bash,subs="+macros,+attributes"] ---- -docker image rm my-image +podman image rm my-image ---- -Great! You're well on your way to becoming a Container Image expert :) +Great! You're well on your way to becoming a Container Image expert :) \ No newline at end of file diff --git a/documentation/modules/ROOT/pages/inside.adoc b/documentation/modules/ROOT/pages/inside.adoc index ac72423..56e1655 100644 --- a/documentation/modules/ROOT/pages/inside.adoc +++ b/documentation/modules/ROOT/pages/inside.adoc @@ -9,7 +9,7 @@ To perform it in our running container, just execute this: [.console-input] [source,bash,subs="+macros,+attributes"] ---- -docker exec -it my-container /bin/bash +podman exec -it my-container /bin/bash ---- Your terminal prompt should by now look like this: @@ -44,7 +44,7 @@ We can also print the VM settings of this container: java -XshowSettings:vm -version ---- -See Maven's installed version: +Since you are not in your host machine, `mvn` cannot be found: [.console-input] [source,bash,subs="+macros,+attributes"] @@ -52,6 +52,12 @@ See Maven's installed version: mvn -v ---- +[.console-output] +[source,bash,subs="+macros,+attributes"] +---- +bash: mvn: command not found +---- + And even check the OS version details: [.console-input] diff --git a/documentation/modules/ROOT/pages/podman-desktop.adoc b/documentation/modules/ROOT/pages/podman-desktop.adoc index 7c392a2..e161ece 100644 --- a/documentation/modules/ROOT/pages/podman-desktop.adoc +++ b/documentation/modules/ROOT/pages/podman-desktop.adoc @@ -39,7 +39,13 @@ image::podman-desktop-nginx.png[alt="Podman Desktop running nginx", align="cente == Creating a Pod -Podman also allows you to create pods, which are groups of containers that share the same network and storage. This is useful for applications that require multiple containers to run together, such as a database and web server. To create a pod, click the *Play Kubernetes YAML* button in the *Pods* tab. This will bring up a dialog where you select the Kubernetes YAML, and apply it to either Podman or a Kubernetes cluster. For this example, we'll create a `podman-desktop-pod.yaml` file with the following content. +Podman also allows you to create pods, which are groups of containers that share the same network and storage. This is useful for applications that require multiple containers to run together, such as a database and web server. + +Before creating the pod, make sure to pull another image: + +* Repeat the steps above to *pull* another image from the registry: `postgres:latest`. + +Create a new file named `podman-desktop-pod.yaml` with the following content: [.console-input] [source,bash,subs="+macros,+attributes"] @@ -65,7 +71,16 @@ spec: value: mysecretpassword ---- -This YAML file will create a pod with two containers, one running nginx and the other running PostgreSQL. The YAML file can be applied to the Podman engine by clicking the *Play* button after selecting the file. This will create the pod and start the containers. + +This YAML file will create a pod with two containers, one running nginx and the other running PostgreSQL: + +1. Click on the *Play Kubernetes Yaml* button in the top right corner. + +2. Click on the *file* button and select the previously created YAML file. + +3. Click on the *Play* button to launch the pod. + +4. Click on the *Done* button. image::podman-desktop-pod-play.png[alt="Podman Desktop Pod Create", align="center"] diff --git a/documentation/modules/ROOT/pages/ports.adoc b/documentation/modules/ROOT/pages/ports.adoc index 862a07f..96c4644 100644 --- a/documentation/modules/ROOT/pages/ports.adoc +++ b/documentation/modules/ROOT/pages/ports.adoc @@ -28,7 +28,7 @@ First let's remove the container: [.console-input] [source,bash,subs="+macros,+attributes"] ---- -docker rm -f my-container +podman rm -f my-container ---- [TIP] @@ -43,7 +43,7 @@ Now we re-create the container, but exposing the port 8080: [.console-input] [source,bash,subs="+macros,+attributes"] ---- -docker run -d --name my-container -p 8080:8080 my-image +podman run -d --name my-container -p 8080:8080 my-image ---- Let's try to reach the application again: diff --git a/documentation/modules/ROOT/pages/pushing.adoc b/documentation/modules/ROOT/pages/pushing.adoc index de17d6a..55be84a 100644 --- a/documentation/modules/ROOT/pages/pushing.adoc +++ b/documentation/modules/ROOT/pages/pushing.adoc @@ -13,7 +13,7 @@ If you have a Docker Hub account: [.console-input] [source,bash,subs="+macros,+attributes"] ---- -docker tag my-image docker.io/myrepository/my-image +podman tag my-image docker.io/myrepository/my-image ---- If using Quay.io: @@ -21,7 +21,7 @@ If using Quay.io: [.console-input] [source,bash,subs="+macros,+attributes"] ---- -docker tag my-image quay.io/myrepository/my-image +podman tag my-image quay.io/myrepository/my-image ---- IMPORTANT: Make sure to replace `myrepository` with the name of your own repository. @@ -33,12 +33,12 @@ If you build your image already using the tag, you won't need to do this step be [.console-input] [source,bash,subs="+macros,+attributes"] ---- -docker build -t quay.io/myrepository/my-image . +podman build -t quay.io/myrepository/my-image . ---- ==== -If you now run `docker images` you'll see something like this: +If you now run `podman images` you'll see something like this: [.console-output] [source,text] @@ -60,7 +60,7 @@ Quay.io:: [.console-input] [source,bash,subs="+macros,+attributes"] ---- -docker login quay.io +podman login quay.io ---- -- Docker Hub:: @@ -69,7 +69,7 @@ Docker Hub:: [.console-input] [source,bash,subs="+macros,+attributes"] ---- -docker login +podman login ---- -- ==== @@ -79,7 +79,7 @@ And finally you can push it, eg.: [.console-input] [source,bash,subs="+macros,+attributes"] ---- -docker push quay.io/myrepository/my-image +podman push quay.io/myrepository/my-image ---- You should have an output like this: diff --git a/documentation/modules/ROOT/pages/runningcontainers.adoc b/documentation/modules/ROOT/pages/runningcontainers.adoc index c184789..cc75837 100644 --- a/documentation/modules/ROOT/pages/runningcontainers.adoc +++ b/documentation/modules/ROOT/pages/runningcontainers.adoc @@ -9,7 +9,7 @@ As we removed the image on the previous step, we need to build it again: [.console-input] [source,bash,subs="+macros,+attributes"] ---- -docker build -t my-image . +podman build -t my-image . ---- Now we are ready to create a container based on this image. Just run: @@ -17,7 +17,7 @@ Now we are ready to create a container based on this image. Just run: [.console-input] [source,bash,subs="+macros,+attributes"] ---- -docker create --name my-container my-image +podman create --name my-container my-image ---- Your container is created. @@ -29,7 +29,7 @@ To see your just created container: [.console-input] [source,bash,subs="+macros,+attributes"] ---- -docker ps +podman ps ---- Your output is probably something like this: @@ -42,12 +42,12 @@ CONTAINER ID IMAGE COMMAND CREATED Why isn't your container in the list if you've just created it? -Because it isn't running, and using plain `docker ps` will only list the running containers. Now try this: +Because it isn't running, and using plain `podman ps` will only list the running containers. Now try this: [.console-input] [source,bash,subs="+macros,+attributes"] ---- -docker ps -a +podman ps -a ---- Now your output should be something like this: @@ -69,15 +69,15 @@ To run the container you've just created, execute this: [.console-input] [source,bash,subs="+macros,+attributes"] ---- -docker start my-container +podman start my-container ---- -To check if it's running, try the plain `docker ps` again: +To check if it's running, try the plain `podman ps` again: [.console-input] [source,bash,subs="+macros,+attributes"] ---- -docker ps +podman ps ---- Now your output will be like this: @@ -99,7 +99,7 @@ To stop your container: [.console-input] [source,bash,subs="+macros,+attributes"] ---- -docker stop my-container +podman stop my-container ---- == Removing containers @@ -109,7 +109,7 @@ To remove your container: [.console-input] [source,bash,subs="+macros,+attributes"] ---- -docker rm my-container +podman rm my-container ---- == Creating and starting a container at once @@ -119,7 +119,7 @@ Instead of creating a container and then starting, you can do it at once: [.console-input] [source,bash,subs="+macros,+attributes"] ---- -docker run --name my-container my-image +podman run --name my-container my-image ---- You now got an output like this: @@ -145,7 +145,7 @@ So let's create a detached container. First we remove this one: [.console-input] [source,bash,subs="+macros,+attributes"] ---- -docker rm my-container +podman rm my-container ---- And now we create it detached: @@ -153,7 +153,7 @@ And now we create it detached: [.console-input] [source,bash,subs="+macros,+attributes"] ---- -docker run -d --name my-container my-image +podman run -d --name my-container my-image ---- == Checking the log of a container @@ -163,7 +163,7 @@ To see what this container is logging, use this: [.console-input] [source,bash,subs="+macros,+attributes"] ---- -docker logs my-container +podman logs my-container ---- If you want to keep following the output: @@ -171,7 +171,7 @@ If you want to keep following the output: [.console-input] [source,bash,subs="+macros,+attributes"] ---- -docker logs -f my-container +podman logs -f my-container ---- Use `CTRL+C` to stop following the log. diff --git a/documentation/modules/ROOT/pages/setup.adoc b/documentation/modules/ROOT/pages/setup.adoc index d48b2d4..c410c25 100644 --- a/documentation/modules/ROOT/pages/setup.adoc +++ b/documentation/modules/ROOT/pages/setup.adoc @@ -6,7 +6,7 @@ include::_attributes.adoc[] The following tools are required for running the exercises in this tutorial. You'll need to have them installed and configured before you get started with any of the tutorial chapters. -TIP: By default, the commands in this tutorial are using Docker, but you use `podman` instead of `docker` throughout the tutorial's instructions, or `alias docker=podman`. The advantage of Podman is that it is 100% Free Open Source and does not need to run with elevated privileges. +TIP: By default, the commands in this tutorial are using podman, but you can use `docker` instead of `podman` throughout the tutorial's instructions as the commands will be identical (eg. `podman run` will be the same as `docker run`). The advantage of Podman is that it is 100% Free Open Source and does not need to run with elevated privileges. [options="header"] |=== @@ -18,12 +18,14 @@ TIP: By default, the commands in this tutorial are using Docker, but you use `po | https://podman-desktop.io/downloads[Podman Desktop for Linux, window="_blank"] | https://podman-desktop.io/downloads[Podman Desktop for Windows, window="_blank"] -| **Java 21 (or 17)** -| https://adoptium.net/installation/ +| **Java 21** | https://adoptium.net/installation/ +| https://adoptium.net/installation/ alternatively: + +`dnf install java-21-openjdk-devel` | https://adoptium.net/installation/ (Make sure you set the `JAVA_HOME` environment variable and add `%JAVA_HOME%\bin` to your `PATH`) -| **Apache Maven 3.6.2+** +| **Apache Maven 3.9.9+** | `brew install maven` | `dnf install maven` | https://maven.apache.org/download.cgi[Windows] (Make sure you set the `MAVEN_HOME` environment variable and add `%MAVEN_HOME%\bin` to your `PATH`) diff --git a/documentation/modules/ROOT/pages/skopeo.adoc b/documentation/modules/ROOT/pages/skopeo.adoc index ca74dcb..dd8b548 100644 --- a/documentation/modules/ROOT/pages/skopeo.adoc +++ b/documentation/modules/ROOT/pages/skopeo.adoc @@ -184,7 +184,7 @@ Storing signatures ---- Now, instead of using `dir` in the destination part, we use the `docker-daemon` destination to set the local registry. -If you run the `docker images` command, you'll see the image downloaded with the `skopeo` tag: +If you run the `podman images` command, you'll see the image downloaded with the `skopeo` tag: [.console-input] [source,bash,subs="+macros,+attributes"] @@ -208,7 +208,7 @@ Run the following command in a terminal window: [.console-input] [source,bash,subs="+macros,+attributes"] ---- -docker run --rm -ti -p 5000:5000 --restart=always --name registry registry:2 +podman run --rm -ti -p 5000:5000 --restart=always --name registry registry:2 ---- In a new terminal window, run the `copy` command setting origin to quay.io and the destination, the registry created in the previous step: