diff --git a/documentation/modules/ROOT/assets/images/podman-desktop-build-image-button.png b/documentation/modules/ROOT/assets/images/podman-desktop-build-image-button.png new file mode 100644 index 0000000..eeae82e Binary files /dev/null and b/documentation/modules/ROOT/assets/images/podman-desktop-build-image-button.png differ diff --git a/documentation/modules/ROOT/assets/images/podman-desktop-build-image-logs.png b/documentation/modules/ROOT/assets/images/podman-desktop-build-image-logs.png new file mode 100644 index 0000000..febd9d7 Binary files /dev/null and b/documentation/modules/ROOT/assets/images/podman-desktop-build-image-logs.png differ diff --git a/documentation/modules/ROOT/assets/images/podman-desktop-build-image-window.png b/documentation/modules/ROOT/assets/images/podman-desktop-build-image-window.png new file mode 100644 index 0000000..2586a57 Binary files /dev/null and b/documentation/modules/ROOT/assets/images/podman-desktop-build-image-window.png differ diff --git a/documentation/modules/ROOT/assets/images/podman-desktop-built-image-layers.png b/documentation/modules/ROOT/assets/images/podman-desktop-built-image-layers.png new file mode 100644 index 0000000..7c831ac Binary files /dev/null and b/documentation/modules/ROOT/assets/images/podman-desktop-built-image-layers.png differ diff --git a/documentation/modules/ROOT/assets/images/podman-desktop-built-image.png b/documentation/modules/ROOT/assets/images/podman-desktop-built-image.png new file mode 100644 index 0000000..28320ed Binary files /dev/null and b/documentation/modules/ROOT/assets/images/podman-desktop-built-image.png differ diff --git a/documentation/modules/ROOT/assets/images/podman-desktop-open-browser-button.png b/documentation/modules/ROOT/assets/images/podman-desktop-open-browser-button.png new file mode 100644 index 0000000..8e1fb83 Binary files /dev/null and b/documentation/modules/ROOT/assets/images/podman-desktop-open-browser-button.png differ diff --git a/documentation/modules/ROOT/assets/images/podman-desktop-push-image-button.png b/documentation/modules/ROOT/assets/images/podman-desktop-push-image-button.png new file mode 100644 index 0000000..3300a83 Binary files /dev/null and b/documentation/modules/ROOT/assets/images/podman-desktop-push-image-button.png differ diff --git a/documentation/modules/ROOT/assets/images/podman-desktop-python-app-browser.png b/documentation/modules/ROOT/assets/images/podman-desktop-python-app-browser.png new file mode 100644 index 0000000..6df457d Binary files /dev/null and b/documentation/modules/ROOT/assets/images/podman-desktop-python-app-browser.png differ diff --git a/documentation/modules/ROOT/assets/images/podman-desktop-python-app-container-details.png b/documentation/modules/ROOT/assets/images/podman-desktop-python-app-container-details.png new file mode 100644 index 0000000..a4ca7b5 Binary files /dev/null and b/documentation/modules/ROOT/assets/images/podman-desktop-python-app-container-details.png differ diff --git a/documentation/modules/ROOT/assets/images/podman-desktop-redis-container-details.png b/documentation/modules/ROOT/assets/images/podman-desktop-redis-container-details.png new file mode 100644 index 0000000..4737554 Binary files /dev/null and b/documentation/modules/ROOT/assets/images/podman-desktop-redis-container-details.png differ diff --git a/documentation/modules/ROOT/assets/images/podman-desktop-redis-container-inspect.png b/documentation/modules/ROOT/assets/images/podman-desktop-redis-container-inspect.png new file mode 100644 index 0000000..d55e8c0 Binary files /dev/null and b/documentation/modules/ROOT/assets/images/podman-desktop-redis-container-inspect.png differ diff --git a/documentation/modules/ROOT/assets/images/podman-desktop-redis-image-layers.png b/documentation/modules/ROOT/assets/images/podman-desktop-redis-image-layers.png new file mode 100644 index 0000000..104bf50 Binary files /dev/null and b/documentation/modules/ROOT/assets/images/podman-desktop-redis-image-layers.png differ diff --git a/documentation/modules/ROOT/assets/images/podman-desktop-redis-image-start.png b/documentation/modules/ROOT/assets/images/podman-desktop-redis-image-start.png new file mode 100644 index 0000000..2e3ae0d Binary files /dev/null and b/documentation/modules/ROOT/assets/images/podman-desktop-redis-image-start.png differ diff --git a/documentation/modules/ROOT/assets/images/podman-desktop-registries-settings.png b/documentation/modules/ROOT/assets/images/podman-desktop-registries-settings.png new file mode 100644 index 0000000..6fc51b6 Binary files /dev/null and b/documentation/modules/ROOT/assets/images/podman-desktop-registries-settings.png differ diff --git a/documentation/modules/ROOT/assets/images/podman-desktop-start-container.png b/documentation/modules/ROOT/assets/images/podman-desktop-start-container.png new file mode 100644 index 0000000..1a2f542 Binary files /dev/null and b/documentation/modules/ROOT/assets/images/podman-desktop-start-container.png differ diff --git a/documentation/modules/ROOT/assets/images/podman-desktop-start-python-container-options.png b/documentation/modules/ROOT/assets/images/podman-desktop-start-python-container-options.png new file mode 100644 index 0000000..b70d82a Binary files /dev/null and b/documentation/modules/ROOT/assets/images/podman-desktop-start-python-container-options.png differ diff --git a/documentation/modules/ROOT/assets/images/podman-desktop-start-python-container.png b/documentation/modules/ROOT/assets/images/podman-desktop-start-python-container.png new file mode 100644 index 0000000..9d52807 Binary files /dev/null and b/documentation/modules/ROOT/assets/images/podman-desktop-start-python-container.png differ diff --git a/documentation/modules/ROOT/assets/images/podman-desktop-start-redis-container-options.png b/documentation/modules/ROOT/assets/images/podman-desktop-start-redis-container-options.png new file mode 100644 index 0000000..fd60f42 Binary files /dev/null and b/documentation/modules/ROOT/assets/images/podman-desktop-start-redis-container-options.png differ diff --git a/documentation/modules/ROOT/assets/images/podman-desktop-start-redis-container.png b/documentation/modules/ROOT/assets/images/podman-desktop-start-redis-container.png new file mode 100644 index 0000000..1a2f542 Binary files /dev/null and b/documentation/modules/ROOT/assets/images/podman-desktop-start-redis-container.png differ diff --git a/documentation/modules/ROOT/assets/images/podman-desktop-tag-image-button.png b/documentation/modules/ROOT/assets/images/podman-desktop-tag-image-button.png new file mode 100644 index 0000000..78b1ccd Binary files /dev/null and b/documentation/modules/ROOT/assets/images/podman-desktop-tag-image-button.png differ diff --git a/documentation/modules/ROOT/assets/images/podman-desktop-tag-image-window.png b/documentation/modules/ROOT/assets/images/podman-desktop-tag-image-window.png new file mode 100644 index 0000000..fe6a721 Binary files /dev/null and b/documentation/modules/ROOT/assets/images/podman-desktop-tag-image-window.png differ diff --git a/documentation/modules/ROOT/nav.adoc b/documentation/modules/ROOT/nav.adoc index 055a733..af037a4 100644 --- a/documentation/modules/ROOT/nav.adoc +++ b/documentation/modules/ROOT/nav.adoc @@ -1,11 +1,10 @@ -* Requirements -** xref:setup.adoc[Podman Desktop Setup] +* xref:setup.adoc[Installing Podman Desktop] * I. Podman Desktop Fundamentals ** xref:intro.adoc[Introduction to Containers] ** xref:podman-basics.adoc[Podman Desktop Interface & Essentials] ** xref:building-images.adoc[Exercise: Building Images in Podman Desktop] -** xref:running-containers.adoc[Running and Managing Containers] +** xref:running-containers.adoc[Exercise: Running and Managing Containers] * II. Container Orchestration with Pods ** xref:pods.adoc[Pods: The Next Level] diff --git a/documentation/modules/ROOT/pages/building-images.adoc b/documentation/modules/ROOT/pages/building-images.adoc index cd385c6..5e6a071 100644 --- a/documentation/modules/ROOT/pages/building-images.adoc +++ b/documentation/modules/ROOT/pages/building-images.adoc @@ -1,17 +1,18 @@ = Exercise: Building Images in Podman Desktop +include::_attributes.adoc[] -Fantastic, let's start the Podman Desktop tutorial with the most basic step in the inner loop development process: building container images. +Fantastic, let's start the Podman Desktop tutorial with the most basic step in the inner loop development process: *building container images*. We'll also cover authenticating to registries amd pulling images. + +TIP: Feel free to down if you'd just like to xref:building-images#pulling.adoc[pull the container images], without downloading the application source code. == Demo Application For this exercise, we'll be using a basic Python web server application, which uses a Redis cache to store the number of times we've visited the webpage. This is a simple microservice, but it's a good example of a multi-container application. -image::podman-desktop-demo-app.png[Podman Desktop Demo App, 600] +image::podman-desktop-python-app-browser.png[Podman Desktop Python App, 600] == Getting Started with the Source Code -TIP: Feel free to skip this section if you'd just like to pull the container images directly in the next step, without downloading the application source code. - Let's start off with downloading the source code for the demo application, found https://github.com/redhat-developer/podman-desktop-demo[here on GitHub]. This repository contains a variety of different Podman related demo's you can try later, including Minikube, WASM, Compose, and more! image::podman-desktop-demo-repo.png[Podman Desktop Demo Repo, 600] @@ -57,4 +58,56 @@ NOTE: While this isn't a basic Dockerfile, it's a good example of a multi-stage == Building the Container Image -Now that we've taken a look at the source code and Dockerfile, let's build the container image from directly within Podman Desktop. From the *Images* section, click the *Build* button in the top right corner. \ No newline at end of file +Now that we've taken a look at the source code and Dockerfile, let's build the container image from directly within Podman Desktop. From the *Images* section, click the *Build* button in the top right corner. + +image::podman-desktop-build-image-button.png[Podman Desktop Build Image, 600] + +This will open up a new window where we can specify the Dockerfile/Containerfile, the build context, and image name. Let's select the `Dockerfile`, the build directory as `primary-podify-demo/front`, and `python-app` for the image name. + +NOTE: The build context is the directory where the source code and Dockerfile are located, and the Dockerfile is the recipe for building the container image. We can use Podman Desktop to easily rename/retag the image later, so don't worry too much about the image name for now. + +image::podman-desktop-build-image-window.png[Podman Desktop Build Image Window, 600] + +After clicking *Build*, Podman Desktop will start building the container image, and you can see the build logs in the bottom pane. This will take a few minutes, as it's downloading the base image, installing dependencies, copying the source code, etc. + +image::podman-desktop-build-image-logs.png[Podman Desktop Build Image Logs, 600] + +Once the build is complete, you should see the new `python-app` image in the *Images* section of Podman Desktop. You'll see the default image https://www.redhat.com/sysadmin/container-image-short-names[short name] here, which we'll retag for our registry in another step. + +image::podman-desktop-built-image.png[Podman Desktop Built Image, 600] + + +[#pulling] +== Optional: Pulling the Python App Image + +If you'd like to skip the build process from above, you can pull the `quay.io/cclyburn/python-app` image from a public registry. This is the same image we just built, but it's already available for use. Head to the *Images* section, and click the *Pull* button in the top right corner. + +[.console-input] +[source,bash,subs="+macros,+attributes"] +---- +quay.io/cclyburn/python-app +---- + +image::podman-desktop-built-image-layers.png[Podman Desktop Built Image, 600] + +TIP: Due to it's popularity, Podman uses the Docker Hub registry to pull images by default. However, you can authenticate other registries in the Podman Desktop *Settings > Registries*, or set defaults via the https://www.redhat.com/sysadmin/manage-container-registries[Podman registry configuration file]. + +== Pulling the Redis Image + +As you may have seen from the Python web application source code, we're using a Redis cache to store the number of times we've visited the webpage. Thus, if you were to start the Python web application without the Redis cache, it would crash. + +image::podman-desktop-redis-image-start.png[Podman Desktop Redis Image, 600] + +Let's go ahead and pull the Redis image from Docker Hub by clicking the *Pull* button from the top right corner menu. We'll be pulling the official `redis` image, which is a popular choice for caching in containerized applications. + +[.console-input][.console-input] +[source,bash,subs="+macros,+attributes"] +---- +redis +---- + +image::podman-desktop-redis-image-layers.png[Podman Desktop Redis Image, 600] + +== Next Steps + +Fantastic! We've built the container image for the Python web application, and pulled the Redis image for the cache. In the next tutorial, we'll start the containers and test the web application. \ No newline at end of file diff --git a/documentation/modules/ROOT/pages/intro.adoc b/documentation/modules/ROOT/pages/intro.adoc index 153cc6e..79cadd2 100644 --- a/documentation/modules/ROOT/pages/intro.adoc +++ b/documentation/modules/ROOT/pages/intro.adoc @@ -1,4 +1,5 @@ = Introduction to Containers +include::_attributes.adoc[] As https://podman-desktop.io[Podman Desktop] is an open source graphical tool for working with containers, let's quickly overview the concept of containers and their benefits. diff --git a/documentation/modules/ROOT/pages/podman-basics.adoc b/documentation/modules/ROOT/pages/podman-basics.adoc index 872150d..6acf3dc 100644 --- a/documentation/modules/ROOT/pages/podman-basics.adoc +++ b/documentation/modules/ROOT/pages/podman-basics.adoc @@ -1,4 +1,5 @@ = Podman Desktop Interface & Essentials +include::_attributes.adoc[] Let's take a look at Podman Desktop and dive into some of the features, tips & tricks, and essentials. We'll start from the top of the UI and work our way down, and don't worry, there's no exercises until the next section. diff --git a/documentation/modules/ROOT/pages/running-containers.adoc b/documentation/modules/ROOT/pages/running-containers.adoc new file mode 100644 index 0000000..4c4b740 --- /dev/null +++ b/documentation/modules/ROOT/pages/running-containers.adoc @@ -0,0 +1,85 @@ += Exercise: Running and Managing Containers +include::_attributes.adoc[] + +In the previous step, we built a container image for our Python web server and pulled a Redis image for our cache. Now it's time to bring those images to life as running containers and experience the power of Podman Desktop in action. + +== Starting the Redis container + +First, let's start the Redis container. We'll go from the *Images* (or *Containers*) section in Podman Desktop, where we can see the Redis image we pulled earlier. Let's hit the *▶* button to start a new container from the image. + +image::podman-desktop-start-redis-container.png[Podman Desktop Start Container, 600] + +We'll be presented with a form to configure the container. We only need to give it a name, `redis`, and hit the *Start* button. + +image::podman-desktop-start-redis-container-options.png[Podman Desktop Start Container, 600] + +TIP: There's settings for the container's volumes, environment variables, port mapping, and much more! We'll leave them as they are for now, but feel free to explore them later. + +== Managing containers + +After a few seconds, the Redis container will be up and running. We'll be brought to the *Container Details* page, where we can see the container's logs, terminal, and other details. + +image::podman-desktop-redis-container-details.png[Podman Desktop Container Details, 600] + +Let's view some of the details from this container, as we'll need to find the internal IP address for Redis to configure our Python web server as a hostname. Head to the *Inspect* tab and *Ctrl-F* to search for `IPAddress`, which will be under the `NetworkSettings` section and will look something like this: + +image::podman-desktop-redis-container-inspect.png[Podman Desktop Container Inspect, 600] + +[.console-output] +[source,bash,subs="+macros,+attributes"] +---- +"IPAddress": "10.88.0.7" +---- + +NOTE: The IP address will be different for your container, but it will be in the same format. + +Be sure to copy this somewhere, as we'll be using it in the next step below. Feel free to explore the other options in the *Container Details* page, such as the logs, terminal, and Kubernetes manifests. We'll be using these features later in the workshop. + +== Starting the Python web server + +Now, let's start the Python web server container. We'll go back to the *Images* (or *Containers*) section in Podman Desktop, where we can see the Python web server image we built/pulled earlier. Let's hit the *▶* button to start a new container from the image. + +image::podman-desktop-start-python-container.png[Podman Desktop Start Container, 600] + +Here, let's navigate to the *Environment* tab and add a new environment variable with the key `redis` and the value as the IP address we copied from the Redis container earlier. Be sure to also give the container a name, such as `python-app`, and hit the *Start* button. + +image::podman-desktop-start-python-container-options.png[Podman Desktop Start Container, 600] + +NOTE: This will allow the Python web server to connect to the Redis cache using the logic from the `entrypoint.sh` script in the Python web application source code. + +== Testing the multi-container application + +With the Python container started, let's test the basic functionality by selecting the *Open Browser* button from the top right corner menu. This will open a new browser window with the Python web server's IP address and port, such as `http://localhost:8080/`. + +image::podman-desktop-open-browser-button.png[Podman Desktop Open Browser, 600] + +You should see a simple web page with a counter, which is being incremented and stored in the Redis cache, and some handy Podman Desktop links! + +image::podman-desktop-python-app-browser.png[Podman Desktop Python App, 600] + +Back in the *Container Details* page for the Python web server container, we see the application's output and logs, debug, and some other options we'll explore later in the tutorial. + +image::podman-desktop-python-app-container-details.png[Podman Desktop Container Details, 600] + +== Authenticating, Tagging, and Pushing the Image + +First, be sure to have an account with a free container registry, such as https://quay.io/[Quay.io] or https://hub.docker.com/[Docker Hub], where you can afterwards authenticate from Podman Desktop in *Settings > Registries* to push and share your container image. + +image::podman-desktop-registries-settings.png[Podman Desktop Registries Settings, 600] + +Now that we've built the container image, we can tag it with a new name for our registry. This is a simple process in Podman Desktop, where we can select the image and click the *Edit Image* button from the top right corner menu. + +image::podman-desktop-tag-image-button.png[Podman Desktop Tag, 600] + +This will open up a new window where we can specify the new image name. Let's tag the `python-app` image as `quay.io//python-app`, using the Quay.io registry, or as `docker.io//python-app`, using the Docker Hub registry. + +image::podman-desktop-tag-image-window.png[Podman Desktop Tag] + +TIP: Here, we can also use tagging to specify versioning of images, such as `quay.io//python-app:1.0.0`, and is a good practice for production use. + +Finally, we can push the image to the registry by selecting the image and clicking the *Push* button from the top right corner menu. This will upload the image to the registry, where it can be shared and used by others, or in remote environments such as Kubernetes & OpenShift. + +image::podman-desktop-push-image-button.png[Podman Desktop Push, 600] + +== Next Steps +