-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
585 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,109 @@ | ||
# EX188: Red Hat Certified Specialist in Containers exam | ||
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. | ||
|
||
|
||
# Exam Practice | ||
To ensure I'm not sharing exam details, these are notes I took *before* the exam based on studying the exam objectives. | ||
|
||
I passed this exam on 2023-08-07. Honestly, if you know where to find the letter "e" on your keyboard to pass env variables to a container, you're 99% of the way there. | ||
|
||
# Exam Practice | ||
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, even though it's not on the exam objectives, because it's easier for me than to use than Podman directly. | ||
|
||
## Pre-requisites | ||
On Ubuntu: | ||
```bash | ||
sudo apt install podman podman-compose | ||
``` | ||
|
||
## Commands | ||
Run a container: | ||
```bash | ||
podman run -d --name container-a --restart unless-stopped localhost/container-a | ||
``` | ||
|
||
Stop a container: | ||
```bash | ||
podman stop container-a | ||
``` | ||
|
||
Remove a container: | ||
```bash | ||
podman rm container-a | ||
``` | ||
|
||
Run a container with a port: | ||
```bash | ||
podman run -d --name container-a --restart unless-stopped -p 8080:80 localhost/container-a | ||
``` | ||
|
||
Create a volume: | ||
```bash | ||
podman volume create volume-a | ||
``` | ||
|
||
Run a container with a volume: | ||
```bash | ||
podman run -d --name container-a --restart unless-stopped -v volume-a:/data localhost/container-a | ||
``` | ||
|
||
Run a container with a bind mount: | ||
```bash | ||
podman run -d --name container-a --restart unless-stopped -v /home/user/data:/data localhost/container-a | ||
``` | ||
|
||
Create a network: | ||
```bash | ||
podman network create network-a | ||
``` | ||
|
||
Run a container with a network: | ||
```bash | ||
podman run -d --name container-a --restart unless-stopped --network network-a localhost/container-a | ||
``` | ||
|
||
Run a container with an environment variable: | ||
```bash | ||
podman run -d --name container-a --restart unless-stopped -e VAR_A=VALUE_A localhost/container-a | ||
``` | ||
|
||
To create an archive for a container: | ||
```bash | ||
podman image save --format oci-archive -o container-a.tar.gz localhost/container-a | ||
``` | ||
|
||
Inspect the container image: | ||
```bash | ||
podman inspect localhost/container-a | ||
``` | ||
|
||
Inspect a running container: | ||
```bash | ||
podman inspect example-a_container-a_1 | ||
``` | ||
|
||
Get the logs from a running container: | ||
```bash | ||
podman logs example-a_container-a_1 | ||
``` | ||
|
||
Execute a command in a running container: | ||
```bash | ||
podman exec -it example-a_container-a_1 /bin/bash | ||
``` | ||
|
||
Run a compose project: | ||
```bash | ||
podman-compose up -d | ||
``` | ||
|
||
Stop a compose project: | ||
```bash | ||
podman-compose stop | ||
``` | ||
|
||
Bring down a compose project: | ||
```bash | ||
podman-compose down | ||
``` |
Oops, something went wrong.