Postgres on podman

Steps to getting PostgreSQL running on Endeavor via Podman.

Install Podman:

sudo pacman -S podman podman-docker

Create the PostgreSQL container:


sudo podman run -d --rm -p 5432:5432 --name postgres -e POSTGRES_PASSWORD=dapassword -e PGDATA=/opt/pgdata --volume /opt/postgres:/opt/pgdata postgres

Copy the backup to the container:

sudo podman cp /home/steven/Downloads/kapowey.tar kapoweypg:/tmp/

Run bash on the container and create the database as the postgres user

sudo podman exec -it 396 /bin/bash
su - postgres
createdb kapowey

Restore the backup on the container:

sudo podman exec -i 396 pg_restore -U postgres -c -v -d kapowey "/tmp/kapowey.tar"

Setup user on database:

CREATE user kapowey with encrypted password 'dapassword';

ALTER database kapowey OWNER to kapowey;

GRANT CONNECT ON DATABASE kapowey TO kapowey;

GRANT all privileges on database kapowey to kapowey;

GRANT all privileges on all tables in schema public to kapowey;