Project

General

Profile

Operations » History » Version 1

Redmine Admin, 10/25/2026 04:28 PM

1 1 Redmine Admin
# Common operations
2
3
## Services
4
5
```
6
systemctl --user daemon-reload                        # after editing any Quadlet file
7
systemctl --user list-units 'db-*' 'site-*' 'net-*' 'nginx-proxy-manager*'
8
systemctl --user status  db-<name>.service site-<name>.service
9
systemctl --user restart db-<name>.service site-<name>.service
10
journalctl --user -u site-<name>.service -e
11
/usr/libexec/podman/quadlet -dryrun -user             # validate Quadlet syntax
12
```
13
14
## Listing / inspecting
15
16
```
17
podman ps -a
18
podman network ls ; podman volume ls ; podman secret ls
19
podman inspect <ctr> --format '{{.ImageName}}'
20
podman inspect <ctr> --format '{{range .Mounts}}{{.Name}} -> {{.Destination}}{{"\n"}}{{end}}'
21
podman inspect <ctr> | jq '.[0].Config.Env'
22
podman logs -f <ctr>
23
podman exec -it <ctr> bash                            # root shell inside, no password
24
```
25
26
## Environment variables inside a container
27
28
```
29
podman exec <ctr> printenv
30
podman exec <ctr> printenv | grep -iE 'ROOT|PASSWORD|KEY'
31
podman exec <ctr> printenv MYSQL_ROOT_PASSWORD | od -c | tail -3   # reveals a stray trailing \n
32
```
33
34
## Secrets
35
36
Injected as env at container start (`Secret=<secret>,type=env,target=VAR`).  
37
38
MariaDB/PostgreSQL only read their `*_PASSWORD` env on **first**  
39
40
initialisation of an empty data dir; afterwards the env var is inert and the  
41
42
real password is whatever is in the DB.
43
44
```
45
podman secret inspect --showsecret <secret>
46
podman secret inspect --showsecret --format '{{.SecretData}}' <secret>
47
48
# always create WITHOUT a trailing newline
49
printf '%s' 'VALUE' | podman secret create <secret> -
50
printf '%s' "$(openssl rand -base64 32)" | podman secret create <secret> -
51
52
# replace: rm + create, then restart the consumers
53
podman secret rm <secret> && printf '%s' 'VALUE' | podman secret create <secret> -
54
```
55
56
## Fixing a secret that has a trailing `\n` (legacy WordPress sites)
57
58
```
59
cat > ~/tmp/fixpw.sh <<'EOF'
60
ROOTPW="$(printf '%s' "$MYSQL_ROOT_PASSWORD")"   # $(...) strips the trailing \n
61
WPPW="$(printf '%s' "$MYSQL_PASSWORD")"
62
mariadb -uroot -p"$MYSQL_ROOT_PASSWORD" <<SQL
63
ALTER USER 'root'@'localhost' IDENTIFIED BY '$ROOTPW';
64
ALTER USER 'root'@'%'         IDENTIFIED BY '$ROOTPW';
65
ALTER USER 'wordpress'@'%'    IDENTIFIED BY '$WPPW';
66
FLUSH PRIVILEGES;
67
SQL
68
EOF
69
podman exec -i db-<name> sh < ~/tmp/fixpw.sh
70
for s in <name>-db-root-password <name>-db-password; do
71
  v="$(podman secret inspect --showsecret --format '{{.SecretData}}' "$s")"
72
  podman secret rm "$s"; printf '%s' "$v" | podman secret create "$s" -
73
done
74
systemctl --user restart db-<name>.service site-<name>.service   # run back to back with the SQL half
75
```
76
77
---
78
79
*Source: `dmz-web-podman-cheatsheet.md` v1.1.1 in the `dmz-web-deploy` repo ([Releases](#)). Edit the wiki and the repo copy together.*
80
Common operations
81
[Services](#)[Listing / inspecting](#)[Environment variables inside a container](#)[Secrets](#)[Fixing a secret that has a trailing \n (legacy WordPress sites)](#)
82
☰