Fill these in once
- Start Postgres
docker run --name postgres -e POSTGRES_PASSWORD=devpassword -p 5432:5432 -v pgdata:/var/lib/postgresql/data -d postgres:17Your data lives in the pgdata volume, so it survives restarts.
- Open a SQL prompt inside it
docker exec -it postgres psql -U postgresType \q to leave.
- Stop and start it later
docker stop postgres && docker start postgres
Check it worked
- Check it's running
docker ps --filter name=postgresConnect from your app with postgresql://postgres:
@localhost:5432/postgres
Undo it
- Remove the container and its data
docker rm -f postgres && docker volume rm pgdata
- Start Postgres
docker run --name postgres -e POSTGRES_PASSWORD=devpassword -p 5432:5432 -v pgdata:/var/lib/postgresql/data -d postgres:17Your data lives in the pgdata volume, so it survives restarts.
- Open a SQL prompt inside it
docker exec -it postgres psql -U postgresType \q to leave.
- Stop and start it later
docker stop postgres && docker start postgres
Check it worked
- Check it's running
docker ps --filter name=postgresConnect from your app with postgresql://postgres:
@localhost:5432/postgres
Undo it
- Remove the container and its data
docker rm -f postgres && docker volume rm pgdata
- Start Postgres
docker run --name postgres -e POSTGRES_PASSWORD=devpassword -p 5432:5432 -v pgdata:/var/lib/postgresql/data -d postgres:17Your data lives in the pgdata volume, so it survives restarts.
- Open a SQL prompt inside it
docker exec -it postgres psql -U postgresType \q to leave.
- Stop and start it later
docker stop postgres; docker start postgres
Check it worked
- Check it's running
docker ps --filter name=postgresConnect from your app with postgresql://postgres:
@localhost:5432/postgres
Undo it
- Remove the container and its data
docker rm -f postgres; docker volume rm pgdata