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