Current Size:
Chakra BreakPoints
base0px
sm480px
md768px
lg992px
xl1280px
2xl1536px
Current Height:Width
widthpx
heightpx

Subjects

Docker Postgres Reference

Date Created: 2023/02/20

Last Update: 2023/03/02

#cheatsheet #docker #notes #postgres

CLI Reference

New And Start Actions

Make New Container

docker run --name <container-name> -it -e POSTGRES_PASSWORD=<postgres-password> -e POSTGRES_USER=<postgres-user> -p 5432:5432 <image-name>

Example

docker run --name pgsql-dev -it -e POSTGRES_PASSWORD=test1234 -e POSTGRES_USER=postgres -p 5432:5432 postgres

Start Existing Container

Usage: docker start [OPTIONS] CONTAINER [CONTAINER...]
Options:
-a, --attach Attach STDOUT/STDERR and forward signals
--detach-keys string Override the key sequence for detaching a container
-i, --interactive Attach container's STDIN
docker start -ia <cotainer-name>

Example

docker start -ia pgsql-dev

Bash Terminal in Container

docker exec -it <container-name> bash

Example

docker exec -it pgsql-dev-2 bash

Access Postgress From Container CLI

Example

psql -h localhost -U postgres
psql -h 127.0.0.1 -U postgres

Trouble shooting

From within the container check what is running on a given port.

grep -w '5432/tcp' /etc/services

More Notes

All Notes
HomeProjects

Links

Home Articles Notes Projects About Style Guide Site Credits

Contact

 [email protected]

Location

🌎 Earth