How to create a docker-compose setup with PostgreSQL and pgAdmin4
Last updated: November 04, 2024
The following Docker Compose configuration is written to quickly set up a PostgreSQL database along with the pgAdmin4 client. For development purposes, this is a convenient solution; however, I wouldn’t recommend using it in production environments.
Below is docker-compose setup with PostgreSQL
and pgAdmin4
. It can be run to setup solution locally.
Conclusion
Such a solution can be used when we want to quickly test something based on PostgreSQL data. Of course, it lacks the passwords required when logging in with pgAdmin or similar tools.
But if I’m being honest, I don’t recommend storing data in containers.
Storing data in containers is generally not recommended for several reasons:
-
Lack of data persistence: Containers are usually designed as temporary units. When a container is deleted or stops running, any data stored inside it is lost. This means that restarting a container or changing the application version can result in data loss.
-
Poor scalability: Containers are often created, destroyed, and replicated across various machines, especially in orchestrated environments like Kubernetes. Data stored locally within a container cannot be easily shared with other instances, which complicates scaling the application and synchronizing data.
-
Challenges with backup and recovery: Backing up and restoring data stored within containers is more challenging and complex compared to using dedicated storage systems like databases or network file systems.
-
Security and access control: Data stored within containers may be more vulnerable to security threats, as containers often run with elevated permissions. Controlling data access becomes more difficult if data is spread across multiple containers, particularly in distributed environments.
-
Disk space management issues: Containers may have limited disk resources and lack flexibility in space management. Containers are not optimized for storing large amounts of data and can quickly hit space limits, leading to errors and instability.
-
Non-compliance with organizational policies: In larger organizations, there are often policies that require data to be stored in specific locations, compliant with legal or industry regulations. Storing data in containers can be challenging to manage and audit for compliance.
My site is free of ads and trackers. Was this post helpful to you? Why not
Reference:
Disqus is great for comments/feedback but I had no idea it came with these gaudy ads.