Created
May 24, 2021 15:50
-
-
Save arielweinberger/a6ccf45fb7501fd1bd15bd5632ea9056 to your computer and use it in GitHub Desktop.
Running PostgreSQL via Docker
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
### 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 |
I know im super late here. For those who got confused at this part, i would like to mention a few points you need to keep in mind when setting up postgres and pgAdmin containers:
1- the default username is postgres. That makes your email: [email protected]
2- when setting the server in pgAdmin, keep in mind that the hostname in the pgAdmin connection settings must match the name of your PostgreSQL container (e.g --name postgres-nest)
otherwise it won't connect
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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":