How to install Postgres in Pop!_OS 22.04 with docker
Make sure you have docker installed first, then execute
docker run -d --rm -P -p 127.0.0.1:5432:5432 -e POSTGRES_PASSWORD="welcome" --name postgres postgres:alpine
Then you can validate with
➜ docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
300c1f5e5b50 postgres:alpine "docker-entrypoint.s…" 2 hours ago Up 2 hours 127.0.0.1:5432->5432/tcp postgres
to connect to the database you can do
➜ docker exec -it postgres psql -U postgres
psql (16.0)
Type "help" for help.
postgres=#