# Postgres + PgAdmin ### **Optional**: - If you want to remove all containers before starting, run the following command: ```shell docker system prune -a ``` ### Create a network In my case, I named as ***web-network*** ```shell docker network create --driver bridge web-network ``` ### Install PostgreSQL Run the following command to download and install Postgres with the most recent version. In my case, I named the Postgres image as ***web-postgres***. You also may change the default user and password. ```shell docker run --name web-postgres --network=web-network -p 5432:5432 -e POSTGRES_PASSWORD=root -e POSTGRES_USER=root -d postgres ``` ### Install PgAdmin Before running the following command, you can make several changes, such as: - *Image name:* web-pgadmin - *External port:* 8887 - *Default email:* email@email.com - *Default password:* root - *Network name:* web-network ```shell docker run --name web-pgadmin --network=web-network -p 8887:80 -e PGADMIN_DEFAULT_EMAIL=email@email.com -e PGADMIN_DEFAULT_PASSWORD=root -d dpage/pgadmin4 ``` After the installation process, you can access PgAdmin application through your browser with the url: ***http://localhost:8887*** or another port that you configured in the previous steps. While you are registering the database settings, make sure to add in the field *Connection - Host name/address* the same name of your Postgres container. In my case, ***web-postgres***. | ***Credits:*** [Prof. Diego Pinho - Programação](https://www.youtube.com/watch?v=CdoBvd_bPdk) Brazilian Portuguese tutorial.