Last active
February 12, 2024 20:34
-
-
Save anehir/1b2dd72f83d866d9fdd42c707264b58a to your computer and use it in GitHub Desktop.
start postgresql server and pgadmin on the same pod with podman
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# create pod | |
podman pod create --name postgrespod -p 9876:80 -p 5432:5432 | |
# add pgadmin container | |
podman run --pod=postgrespod --name pgadmin12 -e 'PGADMIN_DEFAULT_EMAIL=postgres@postgres.me' -e 'PGADMIN_DEFAULT_PASSWORD=postgres' -d docker.io/dpage/pgadmin4:latest | |
# run below line only once | |
# podman pull docker.io/library/postgres:latest | |
# add postgres container | |
mkdir ~/src/db/dev | |
podman run --pod=postgrespod --name db -v ~/src/db/dev:/var/lib/postgresql/data:Z -d -e POSTGRES_PASSWORD=postgres -e POSTGRES_USER=postgres docker.io/library/postgres:latest | |
# test psql | |
psql -h localhost -p 5432 -U postgres | |
# browse this url to test pgadmin: | |
# http://localhost:9876/ | |
# useful commands | |
podman pod pause postgrespod | |
podman pod unpause postgrespod | |
podman pod start postgrespod | |
podman pod stop postgrespod | |
# generate yaml | |
podman generate kube postgrespod > postgrespod-conf.yml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# remove /tmp folder | |
sudo rm -r /tmp | |
# add below line to /etc/fstab | |
LABEL=tmpfs /tmp ext4 defaults 0 0 | |
# create /tmp folder | |
sudo mkdir /tmp | |
sudo chmod 1777 /tmp | |
# make root shared | |
mount --make-rshared / | |
# exit wsl and reboot from cmd | |
exit | |
# cmd: | |
> wsl --shutdown | |
> wsl |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment