Database with Docker
Setting up a relational database management system on a personal computer can be time-consuming. It usually requires installing the database server, configuring users, creating a database, and installing a client application to connect to it.
Docker greatly simplifies this process by packaging everything into isolated containers. With a single command, you can start a complete working environment including PostgreSQL and CloudBeaver, without having to install or configure either application manually.
1 Prerequisites
-
- or clone this repository
2 Start the environment
-
docker compose up -d
This command creates and starts two containers:
- PostgreSQL, containing the
ensaidatabase. - CloudBeaver, a web interface used to browse and query the database.
Other usefull commands:
docker compose stop # To stop the containers without deleting the database
docker compose start # To restart them later
docker compose down -v # To completely remove the containers and the PostgreSQL data3 Connect to CloudBeaver
CloudBeaver is deployed on port 8978.
At the first startup, you have to create an admin account and login:
4 Create the PostgreSQL connection
The next step is to connect to the PostgreSQL database.
-
- Host: postgres
- Database: ensai
- Username: ensai
- Password: ensai
These values are those provided in the docker-compose.yml file.
The connection now appears in the explorer on the left.
And here we go!