49 lines
1.3 KiB
Markdown
49 lines
1.3 KiB
Markdown
# Podman
|
|
|
|
## Networks
|
|
|
|
```bash
|
|
# Create a podman network to group shared containers
|
|
podman network create test1
|
|
# Create an iperf3 container running on that network
|
|
podman run -d --name iperf3 --network test1 docker.io/networkstatic/iperf3 -s
|
|
# A container running in the same network can reference another pod by its name
|
|
podman run --rm -it --network test1 docker.io/networkstatic/iperf3 -c iperf3
|
|
# A container outside the created network can't talk to other containers
|
|
# This will fail
|
|
podman run --rm -it docker.io/networkstatic/iperf3 -c iperf3
|
|
```
|
|
|
|
## Healthchecks
|
|
|
|
TCP Healthchecks can be accomplished with netcat (netcat-openbsd)
|
|
|
|
```bash
|
|
podman run -d --name iperf3 \
|
|
--health-cmd='CMD-SHELL iperf3 -n 1 -c localhost' \
|
|
--health-interval=10s --health-timeout=5s --health-retries=3 \
|
|
docker.io/networkstatic/iperf3 iperf3 -s
|
|
```
|
|
|
|
HTTP Healthchecks can be accomplished with curl
|
|
|
|
```bash
|
|
podman run -d --name nginx \
|
|
--health-cmd='CMD-SHELL curl --fail http://127.0.0.1:80 || exit 1' \
|
|
--health-interval=10s --health-timeout=5s --health-retries=3 \
|
|
docker.io/nginx
|
|
```
|
|
|
|
Check healthchecks with
|
|
|
|
```bash
|
|
podman --log-level debug healthcheck run <container>
|
|
```
|
|
|
|
## Volume Import and Export
|
|
|
|
```bash
|
|
podman volume export myvol --output myvol.tar
|
|
podman volume import myvol test.tar
|
|
```
|