PostgreSQL server images based on openSUSE official repository.
739
This PostgreSQL server image is based on opensuse:latest and using the OBS repository server:database:postgresql for the DB package itself.
The version of the DB is specified by the tag of the image.
For persistent data storage be sure to create a volume to contain it before or during container creation. Beware of data lose if you do not store your data in a volume.
To start the DB server in the simplest of terms with no persistent storage across container upgrades:
docker run -d --name postgres-dbs heimergroup/postgres
More complete example with persistent storage of data, other than default username (also name of the database) and with a password, and on a different network than the default bridge (NOTE: Create the network first):
docker run -d -e POSTGRES_USER=auser \
-e POSTGRES_PASSWORD=apasswd \
--name auser-dbs --network somenetwork \
--volume auser-dbs-data:/var/lib/pgsql heimergroup/postgres
You may or may not have to expose the port depending on how you will connect to the DB. Now with it running you can load data with whatever process you wish or below you can create an image with this as the base and preload tables, data, etc.
If you use this image as the base for your image the entry point will allow you to run extra scripts as needed, load tables so they already exist in your image, etc.
Create the directory 'docker-entrypoint.d' in your build directory. The entry point will look for files matching the patterns *.sh and *.sql in the directory and execute them one by one when the container is created. NOTE: This only applies if the DB does not already exist, restarting the container will not cause these items to run again. To have them load in order place a sequence number at the beginning of the filename, such as 001, 002, etc. These scripts and SQL can do various things such as creating your DB schema before loading in your initial data. *.sh files are executed with /bin/bash and *.sql files are executed via psql as the POSTGRES_USER.
FROM heimergroup/postgres:latest
COPY ./docker-entrypoint.d /docker-entrypoint.d
This is an example of how the Zabbix database tables are created and automatically loaded for the image zabbix-dbs.
Content type
Image
Digest
Size
117.3 MB
Last updated
about 9 years ago
docker pull heimergroup/postgres