Postgres database server on docker
1.3K
This repository contains the Dockerfile and resources to build a lightweight and efficient PostgreSQL container based on the latest Debian image. The container is designed to run PostgreSQL securely and flexibly, providing a robust foundation for database-driven applications.
PGSQL_VERSION), defaults to 17.LANG, CC, and ENCODING).docker-entrypoint.sh script for initialization.gosu to manage privilege escalation./var/lib/postgresql/data for data persistence.listen_addresses = '*')./docker-entrypoint-initdb.d./var/lib/postgresql/data: Directory to store database files.Place any .sql or .sh files into /docker-entrypoint-initdb.d to run during container initialization.
This image incorporates best practices for security:
(postgres).git clone https://github.com/mach1el/docker-library.git && \
cd docker-library/postgresql && \
docker buildx build --platform linux/amd64 build -t postgresql .
docker build --build-arg PGSQL_VERSION=17 -t mich43l/postgresql .
Build with arguments
| Variables | Default | Description |
|---|---|---|
| PGSQL_VERSION | 17 | Default postgresql version. |
| CC | en_US | Specifies the input source file for locale definitions. |
| LANG | en_US.UTF-8 | Specifies the name of the locale to generate. |
| ENCODING | UTF-8 | Specifies the character encoding file to use for the locale. |
| Variables | Default | Description |
|---|---|---|
| CC | en_US | Specifies the input source file for locale definitions. |
| LANG | en_US.UTF-8 | Specifies the name of the locale to generate. |
| ENCODING | UTF-8 | Specifies the character encoding file to use for the locale. |
| POSTGRES_DB | postgre | Specify name for database. |
| POSTGRES_USER | postgre | Use other username instead of postgres. |
| POSTGRES_PASSWORD | postgre | Change default postgres password. |
| POSTGRES_LOG_STATEMENT | all | Specify postgres log statment mode. |
docker run -d \
--name postgresql \
-e POSTGRES_USER=youruser \
-e POSTGRES_PASSWORD=yourpassword \
-e POSTGRES_DB=yourdatabase \
-v /path/to/data:/var/lib/postgresql/data \
-p 5432:5432 \
mich43l/postgresql
Content type
Image
Digest
sha256:d196761ee…
Size
188.7 MB
Last updated
almost 2 years ago
docker pull mich43l/postgresql