The Red Hat Ecosystem Catalog is the official source for discovering and learning more about the Red Hat Ecosystem of both Red Hat and certified third-party products and services.
We’re the world’s leading provider of enterprise open source solutions—including Linux, cloud, container, and Kubernetes. We deliver hardened solutions that make it easier for enterprises to work across platforms and environments, from the core datacenter to the network edge.
End of life notice: The rhel8/postgresql-96
container image reaches its end of life in November 2021. Update to rhel8/postgresql-12
prior to this date. See the Application Streams Life Cycle for Red Hat Enterprise Linux 8 at https://access.redhat.com/support/policy/updates/rhel8-app-streams-life-cycle.
This container image provides a containerized packaging of the PostgreSQL postgres daemon and client application. The postgres server daemon accepts connections from clients and provides access to content from PostgreSQL databases on behalf of the clients. You can find more information on the PostgreSQL project from the project Web site (https://www.postgresql.org/).
For this, we will assume that you are using the rhel8/postgresql-96
image, available via postgresql:9.6
imagestream tag in Openshift.
If you want to set only the mandatory environment variables and not store the database
in a host directory, execute the following command:
$ podman run -d --name postgresql_database -e POSTGRESQL_USER=user -e POSTGRESQL_PASSWORD=pass -e POSTGRESQL_DATABASE=db -p 5432:5432 rhel8/postgresql-96
This will create a container named postgresql_database
running PostgreSQL with
database db
and user with credentials user:pass
. Port 5432 will be exposed
and mapped to the host. If you want your database to be persistent across container
executions, also add a -v /host/db/path:/var/lib/pgsql/data
argument (see
below). This will be the PostgreSQL database cluster directory.
The same can be achieved in an Openshift instance using templates provided by Openshift or available in examples:
$ oc process -f examples/postgresql-ephemeral-template.json -p POSTGRESQL_VERSION=9.6 -p POSTGRESQL_USER=user -p POSTGRESQL_PASSWORD=pass -p POSTGRESQL_DATABASE=db | oc create -f -
If the database cluster directory is not initialized, the entrypoint script will
first run initdb
and setup necessary database users and passwords. After the database is initialized,
or if it was already present, postgres
is executed and will run as PID 1. You can stop the detached container by running
podman stop postgresql_database
.
The image recognizes the following environment variables that you can set during
initialization by passing -e VAR=VALUE
to the Docker run command.
POSTGRESQL_USER
User name for PostgreSQL account to be created
POSTGRESQL_PASSWORD
Password for the user account
POSTGRESQL_DATABASE
Database name
POSTGRESQL_ADMIN_PASSWORD
Password for the postgres
admin account (optional)
Alternatively, the following options are related to migration scenario:
POSTGRESQL_MIGRATION_REMOTE_HOST
Hostname/IP to migrate from
POSTGRESQL_MIGRATION_ADMIN_PASSWORD
Password for the remote 'postgres' admin user
POSTGRESQL_MIGRATION_IGNORE_ERRORS (optional, default 'no')
Set to 'yes' to ignore sql import errors
For further detailed documentation, see https://github.com/sclorg/postgresql-container/blob/generated/9.6/root/usr/share/container-scripts/postgresql/README.md.
Dockerfile and other sources for this container image are available on https://github.com/sclorg/postgresql-container. In that repository, the Dockerfile for CentOS is called Dockerfile, the Dockerfile for RHEL7 is called Dockerfile.rhel7, the Dockerfile for RHEL8 is called Dockerfile.rhel8, and the Dockerfile for Fedora is called Dockerfile.fedora.
The following information was extracted from the containerfile and other sources.
Summary | PostgreSQL is an advanced Object-Relational database management system |
Description | PostgreSQL is an advanced Object-Relational database management system (DBMS). The image contains the client and server programs that you'll need to create, run, maintain and access a PostgreSQL DBMS server. |
Provider | Red Hat |
Maintainer | SoftwareCollections.org <sclorg@redhat.com> |
The following information was extracted from the containerfile and other sources.
Repository name | rhel8/postgresql-96 |
Image version | 1 |
Architecture | amd64 |
Usage | podman run -d --name postgresql_database -e POSTGRESQL_USER=user -e POSTGRESQL_PASSWORD=pass -e POSTGRESQL_DATABASE=db -p 5432:5432 rhel8/postgresql-96 |
Exposed ports | 5432:postgresql |
User | 26 |
Working directory | /var/lib/pgsql |
Use the following instructions to get images from a Red Hat container registry using registry service account tokens. You will need to create a registry service account to use prior to completing any of the following tasks.
First, you will need to add a reference to the appropriate secret and repository to your Kubernetes pod configuration via an imagePullSecrets field.
Then, use the following from the command line or from the OpenShift Dashboard GUI interface.
Use the following command(s) from a system with podman installed
Use the following command(s) from a system with docker service installed and running
Use the following instructions to get images from a Red Hat container registry using your Red Hat login.
For best practices, it is recommended to use registry tokens when pulling content for OpenShift deployments.
Use the following command(s) from a system with podman installed
Use the following command(s) from a system with docker service installed and running
Source code is available for all Red Hat UBI-based images in the form of downloadable containers. Here are a few things you should know about Red Hat source containers.
Use skopeo to copy the source image to a local directory
Inspect the image
Untar the contents
Begin examining and using the content.