A customized PostgreSQL Docker image based on PostgreSQL 16.4, configured to allow remote connections with SCRAM-SHA-256 authentication.
- Features
- Prerequisites
- Building the Image
- Running the Container
- Connecting to the Database
- Configuration
- Files
- License
- Based on official PostgreSQL 16.4 image
- Pre-installed dependencies: gettext, postgresql-client, net-tools
- Configured for remote connections with SCRAM-SHA-256 authentication
- Automatic configuration reload
- Docker installed on your system
To build the Docker image, run the following command in the project directory:
docker build -t bodzify-db-postgres .To run the PostgreSQL container, use:
docker run -d \
--name my-postgres \
-e POSTGRES_PASSWORD=mysecretpassword \
-e POSTGRES_DB=mydatabase \
-p 5432:5432 \
bodzify-db-postgresThe container supports standard PostgreSQL environment variables:
POSTGRES_PASSWORD: Sets the password for the default postgres userPOSTGRES_USER: Sets the username for the default user (defaults to postgres)POSTGRES_DB: Sets the name of the default database
- 5432: Default PostgreSQL port
Once the container is running, you can connect to the database using any PostgreSQL client:
psql -h localhost -p 5432 -U postgres -d mydatabaseThe image includes custom configuration in setup_conf.sh that:
- Adds a pg_hba.conf entry to allow remote connections from any IP with SCRAM-SHA-256 authentication
- Reloads the PostgreSQL configuration
Dockerfile: Docker image definitioninstall_dependencies.sh: Script to install additional dependenciessetup_conf.sh: Script to configure PostgreSQL for remote access
[Specify your license here]