For this I'm just going to create some containers using as many of the Containerfile keywords as possible, then run them in different ways with Podman.
I passed this exam on 2023-08-07. Honestly, if you know where to find the letter "e" on your keyboard, you're 99% of the way there.
To ensure I'm not sharing exam details, these are notes I took before the exam based on studying the exam objectives. I'm using Podman Compose in some parts of this repo, even though it's not on the exam objectives, because it's easier for me than to use than Podman directly.
On Ubuntu:
sudo apt install podman podman-compose
Run a container:
podman run -d --name container-a --restart unless-stopped localhost/container-a
Stop a container:
podman stop container-a
Remove a container:
podman rm container-a
Run a container with a port:
podman run -d --name container-a --restart unless-stopped -p 8080:80 localhost/container-a
Create a volume:
podman volume create volume-a
Run a container with a volume:
podman run -d --name container-a --restart unless-stopped -v volume-a:/data localhost/container-a
Run a container with a bind mount:
podman run -d --name container-a --restart unless-stopped -v /home/user/data:/data localhost/container-a
Create a network:
podman network create network-a
Run a container with a network:
podman run -d --name container-a --restart unless-stopped --network network-a localhost/container-a
Run a container with an environment variable:
podman run -d --name container-a --restart unless-stopped -e VAR_A=VALUE_A localhost/container-a
To create an archive for a container:
podman image save --format oci-archive -o container-a.tar.gz localhost/container-a
Inspect the container image:
podman inspect localhost/container-a
Inspect a running container:
podman inspect example-a_container-a_1
Get the logs from a running container:
podman logs example-a_container-a_1
Execute a command in a running container:
podman exec -it example-a_container-a_1 /bin/bash
Run a compose project:
podman-compose up -d
Stop a compose project:
podman-compose stop
Bring down a compose project:
podman-compose down