Here I'm running the most recent version of Postgres 10x in detached mode on port 5555, storing the data files in the current directory.
$ docker run --rm --name pg-10 -e POSTGRES_PASSWORD=supersecret -d -p 5555:5432 -v $(pwd):/var/lib/postgresql/data postgres:10
Then login into the database with:
$ psql -h 127.0.0.1 -p 5555 -U postgres -d postgres
Create the database:
$ psql -h 127.0.0.1 -p 5555 -U postgres -d postgres -c "CREATE DATABASE mydb"
See if it got created:
$ psql -h 127.0.0.1 -p 5555 -U postgres -d postgres -c "SELECT datname FROM pg_database"
Delete the database:
$ psql -h 127.0.0.1 -p 5555 -U postgres -d postgres -c "DROP DATABASE mydb"
Restore from a postgres compressed dump file:
$ pg_restore -C -e -O -x -v -Fc -h 127.0.0.1 -p 5555 -U postgres -j 4 <mydumpfile>