Learning postgres using podman



I thought of learning postgres. Instead of installing in the host machine how difficult it would be to spin up the container. Let’s find out.

Installing podman

sudo apt install podman

Let’s check podman

podman pull postgres
ERRO[0000] User-selected graph driver "vfs" overwritten by graph driver "overlay" from database - delete libpod local files to resolve 
sudo apt install fuse-overlayfs

Pod initialize

podman pod create --name postgres-pod -p 9876:80
podman run --pod=postgres-pod \
-v ~/Documents/Postgres:/var/lib/postgresql/data \
-e POSTGRES_PASSWORD=goldayan \
-e POSTGRES_USER=goldayan \
--name db \
-d postgres
podman run --pod=postgres-pod \
-v ~/Documents/Postgres:/var/lib/postgresql/data \
-e POSTGRES_PASSWORD=goldayan \
-e POSTGRES_USER=goldayan \
--name db \
-d docker.io/postgres
podman run --pod=postgres-pod \
-e 'PGADMIN_DEFAULT_EMAIL=me@goldayan.in' \
-e 'PGADMIN_DEFAULT_PASSWORD=goldayan' \
--name pgadmin \  # name the container
-d docker.io/dpage/pgadmin4   # the image we are pulling

Pod commands

podman pod stats postgres-pod
podman pod pause postgres-pod
podman pod unpause postgres-pod
podman pod start postgres-pod
podman pod stop postgres-pod
podman generate kube postgres-pod >> postgres-pod-conf.yml

Log into postgres container

podman exec -it db bash
psql -U goldayan

When importing csv file in pgadmin

Reset the podman [WARN]

podman system reset
sudo rm -rf ~/.local/share/containers/

Reference