You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
type filter hook output priority filter; policy drop;
2531
+
tcp dport 443 accept
2532
+
udp dport 53 accept
2533
+
}
2534
+
}
2535
+
" | /usr/bin/nft -f -
2536
+
```
2537
+
5. Change file permissions
2538
+
```
2539
+
chmod 755 /home/test/configure-firewall.bash
2540
+
```
2541
+
6. Run curl command to dowload http://podman.io
2542
+
```
2543
+
podman run \
2544
+
--rm \
2545
+
--hooks-dir ~/hooks.d \
2546
+
--annotation myannotation=yes \
2547
+
docker.io/library/fedora \
2548
+
bash -c "curl -sS --connect-timeout 3 http://podman.io | head -1"
2549
+
```
2550
+
The command fails and the following error is printed
2551
+
```
2552
+
curl: (28) Connection timed out after 3000 millisecond
2553
+
```
2554
+
7. Run curl command to dowload https://podman.io
2555
+
```
2556
+
podman run \
2557
+
--rm \
2558
+
--hooks-dir ~/hooks.d \
2559
+
--annotation myannotation=yes \
2560
+
docker.io/library/fedora \
2561
+
bash -c "curl -sS --connect-timeout 3 https://podman.io | head -1"
2562
+
```
2563
+
The command succeeds and the following output is printed
2564
+
```
2565
+
<!doctype html>
2566
+
```
2567
+
2568
+
When configuring a container unit (quadlet), specify the hooks directory with [`GlobalArgs=`](https://docs.podman.io/en/latest/markdown/podman-systemd.unit.5.html#globalargs) under the `[Container]` section.
2569
+
For example
2570
+
```
2571
+
GlobalArgs=--hooks-dir=%h/hooks.d
2572
+
```
2573
+
The string `%h` is a [systemd specifier](https://www.freedesktop.org/software/systemd/man/latest/systemd.unit.html#Specifiers) that is replaced with the home directory.
2574
+
2575
+
</details>
2576
+
2577
+
See also blog post [_Firewall a podman container_](https://jerabaul29.github.io/jekyll/update/2025/10/17/Firewall-a-podman-container.html)
2578
+
by Jean Rabault (published October 2025). See also Podman GitHub [discussion](https://github.com/containers/podman/discussions/27099).
2579
+
2466
2580
# Capture network traffic
2467
2581
2468
2582
The pasta option __--pcap__ enables capturing of network traffic.
0 commit comments