Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save arielweinberger/a6ccf45fb7501fd1bd15bd5632ea9056 to your computer and use it in GitHub Desktop.
Save arielweinberger/a6ccf45fb7501fd1bd15bd5632ea9056 to your computer and use it in GitHub Desktop.
Running PostgreSQL via Docker
### This gist is a part of the NestJS Zero to Hero course on Udemy.
### https://www.udemy.com/course/nestjs-zero-to-hero/?referralCode=F672C0C701844DC91F4D
To run PostgreSQL on Docker, run the following in your Terminal:
docker run --name postgres-nest -p 5432:5432 -e POSTGRES_PASSWORD=postgres -d postgres
@khalilsayhi
Copy link

i tried running this but the container exits as soon as it starts
Error: Database is uninitialized and superuser password is not specified.

You must specify POSTGRES_PASSWORD to a non-empty value for the

superuser. For example, "-e POSTGRES_PASSWORD=password" on "docker run".

You may also use "POSTGRES_HOST_AUTH_METHOD=trust" to allow all

connections without a password. This is not recommended.

See PostgreSQL documentation about "trust":

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment