Show bind points for an already created container

To list all containers: docker container ls --all

To check a container’s bind volumes:

$ docker container inspect f954fb176903 -f '{{ .HostConfig.Binds }}'
[db-localdir:/database]

Create a postgres db quickly using Docker

docker run -itd \
--name postgresfhir \
--shm-size=256m \
--sysctl net.core.somaxconn=256 \
--sysctl net.ipv4.tcp_syncookies=0 \
--hostname db \
-e POSTGRES_USER=postgres \
-e POSTGRES_PASSWORD=change-password \
-e PGDATA=/var/lib/postgresql/data/pgdata \
-e POSTGRES_DB=fhirdb \
-p 5432:5432 \
--privileged \
postgres:12.5
docker exec -it postgresfhir bash

In the terminal startup a psql

psql -d fhirdb

Run the following sql…

CREATE USER fhirbatch WITH LOGIN encrypted password 'change-password';
CREATE USER fhirserver WITH LOGIN encrypted password 'change-password';

GRANT CONNECT ON DATABASE fhirdb TO fhirserver;
GRANT CONNECT ON DATABASE fhirdb TO fhirbatch;
exit;

Exit and you have a working docker image with the postgres docker.