Skip to content

Commit c564a7a

Browse files
committed
q
1 parent c26298f commit c564a7a

File tree

2 files changed

+52
-26
lines changed

2 files changed

+52
-26
lines changed
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,2 @@
11
su ubuntu
22
cd ~
3-
podman build -t try-me /home/ubuntu/quadlet
+52-25
Original file line numberDiff line numberDiff line change
@@ -1,43 +1,70 @@
1+
To enhance your Killercoda lab scenario, let's integrate Podman's Quadlet feature to manage containers as systemd services. This approach aligns with Red Hat's methodologies and leverages systemd for container orchestration.
12

3+
## **Step 1: Build the Container Image**
24

3-
Ok, first let's examine whether we have some images on the machine that we
4-
can turn into systemd services.
5+
First, ensure you have the necessary files in the `~/quadlet` directory, including the `Dockerfile`. Build the image using Podman:
56

67
```bash
7-
podman images
8-
```{exec}
8+
podman build -t try-me ~/quadlet
9+
```
910

10-
Oh, actually, we have something! It's called **try-me**.
1111

12-
We don't know what it's doing.
13-
Fortunately, the previous colleague left instructions on how to deploy them in a
14-
**Docker Compose file**, so we don't have to worry too much.
12+
## **Step 2: Verify Available Images**
1513

16-
Unfortunately, we are the **Red Hat team**, so we use **Podman** instead.
17-
Maybe there will be something interesting.
14+
After building, confirm the presence of the `try-me` image:
1815

19-
Let's examine the **Docker Compose file**:
16+
```bash
17+
podman images
18+
```
19+
20+
21+
### **Step 3: Review the Docker Compose File**
22+
23+
Although your colleague provided a Docker Compose file, we'll translate its configurations to Quadlet for systemd integration. Examine the file to understand the service requirements:
2024

2125
```bash
2226
less docker-compose.yml
23-
```{exec}
24-
Ok, so we've got it—no need to worry.
25-
We need the service that
27+
```
28+
29+
30+
**Service Requirements Identified:**
31+
32+
- Mounts `/test` directory
33+
34+
- Exposes port `8000`
2635

27-
Requiers mounts /test
28-
* It has to be run on port 8000
29-
* it needs to be preseinatnt
30-
* And i has to execute
31-
* serve to properly use the conaienr
36+
- Requires persistent storage
3237

33-
Ok but how to acctualy do that we know that redhat enables us to do that
34-
wihtout generating it based on this file but how to check
35-
As i rembermer the quadlet was avaible at verison 4.4 > so mayb podman -V
36-
Or even easier just type man quadlet
37-
There u have the table of options at the end of the set
38+
- Executes the `serve` command
3839

40+
**Step 4: Implement Quadlet for systemd Integration**
3941

42+
Quadlet simplifies running Podman containers under systemd by using dedicated unit files. To utilize Quadlet, create a `.container` file describing your service. For example:
4043

41-
if u evere feel stuck therse an option for u to
44+
```ini
45+
[Unit]
46+
Description=Try-Me Container
4247

48+
[Container]
49+
Image=localhost/try-me:latest
50+
Exec=serve
51+
Mount=/test:/test
52+
Port=8000:8000
53+
[Install]
54+
WantedBy=multi-user.target
55+
```
56+
57+
58+
59+
Save this file as `try-me.container` in the appropriate systemd directory, typically `/etc/containers/systemd/`. This configuration ensures that systemd manages the container, maintaining consistency with Red Hat's practices. citeturn0search6
60+
61+
**Step 5: Enable and Start the Service**
62+
63+
Reload systemd to recognize the new service, then enable and start it:
64+
65+
```bash
66+
systemctl --user daemon-reload
67+
systemctl --user enable try-me.service
68+
systemctl --user start try-me.service
69+
```
4370

0 commit comments

Comments
 (0)