Post

Podman commands

Assuming there are more containers running in a single Podman `pod`.

Assuming there are more containers running in a single Podman pod
  • some backend service on port 9011
  • phpMyAdmin at port 80 (interpreted by Apache2 inside container)

This command creates a phpMyAdmin container inside an existing Podman pod. The PMA_ABSOLUTE_URI environment variable tells phpMyAdmin the base URL it is served from, which is needed when running behind a reverse proxy.

1
podman create --restart=always --pod=some-pod-name --name=phpmyadmin -e PMA_ABSOLUTE_URI="https://some.subdomain.com/insight/" phpmyadmin/phpmyadmin:5.2.0

You can attach a tcpdump container to the same pod for network debugging. Since all containers in a Podman pod share the same network namespace, tcpdump will see all traffic.

1
2
podman run  --restart=always -it --pod=some-pod-name --name=tcpdump --entrypoint=/bin/sh kaazing/tcpdump

Useful Nginx snippet to proxy to phpMyAdmin

This Nginx server block proxies API requests to a backend service and serves a frontend SPA from static files. The /insight/ location block reverse-proxies requests to the phpMyAdmin container running on port 80 within the same pod.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
server {
    listen       8091;
    server_name some.subdomain.com;

    location /api/ {
        proxy_pass "http://127.0.0.1:8011/";

        # WebSocket support (nginx 1.4)
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection "upgrade";
    }

    location / {
        root   /usr/share/nginx/html;
        index  index.html index.htm;
        try_files $uri $uri/ /index.html;
    }

    error_page   500 502 503 504  /50x.html;
    location = /50x.html {
        root   /usr/share/nginx/html;
    }

    # phpMyAdmin section
    location ~ ^/insight/ {
        rewrite ^/insight(/.*)$ $1 break;
        proxy_pass http://127.0.0.1;
    }

}
This post is licensed under CC BY 4.0 by the author.