- Pull latest postgres docker image
docker pull postgres
- Create a directory to mount volumes and persist container data
mkdir -p $HOME/docker/volumes/postgres
- Start the thing
docker run --rm --name pg-docker -e POSTGRES_PASSWORD=docker -d -p 127.0.0.1:5432:5432 -v $HOME/docker/volumes/postgres:/var/lib/postgresql/data postgres