DirectorySecurity AdvisoriesPricing
Sign inRequest a trial
Directory
postgres-fips logoFIPS

postgres-fips

Last changed

Request a free trial

Contact our team to test out this image for free. Please also indicate any other images you would like to evaluate.

Request trial
Tags
Overview
Comparison
Provenance
Specifications
SBOM
Vulnerabilities
Advisories

Chainguard Container for postgres-fips

Advanced object-relational database management system

Chainguard Containers are regularly-updated, secure-by-default container images.

Download this Container Image

For those with access, this container image is available on cgr.dev:

docker pull cgr.dev/ORGANIZATION/postgres-fips:latest

Be sure to replace the ORGANIZATION placeholder with the name used for your organization's private repository within the Chainguard Registry.

Compatibility Notes

The Chainguard postgres-fips image is comparable to the PostgreSQL image from Docker Hub. However, the Chainguard postgres-fips image contains only the minimum set of tools and dependencies needed to function; for example, it does not include a package manager. Unlike many other Chainguard Containers, though, the PostgreSQL image does include a shell, allowing you to manage databases interactively.

FIPS Support

This Chainguard Container ships with a validated redistribution of OpenSSL's FIPS provider module. For more on FIPS support in Chainguard Containers, consult the guide on FIPS-enabled Chainguard Containers on Chainguard Academy.

Migrating to Chainguard PostgreSQL container images

When migrating an existing PostgresSQL database to use one of Chainguard's PostgreSQL container images it is likely that the collation version in the Chainguard container image will be different from the collation version in the original image that created the database. This may be due to different glibc versions, use of a different implementation of the C standard library (musl in Alpine for example), or the use of different locale configuration.

Chainguard recommends that you re-index and refresh the collation version when migrating to this image before the database is put back into production.

Getting Started

This section provides a high-level overview of how you can use Chainguard's postgres-fips container image. For a more in-depth walkthrough of how you can use the image in practice, please refer to our guide on getting started with the PostgreSQL Chainguard Container. This getting started guide outlines how to set up and run a PHP application that stores its data in a PostgreSQL database running within a containerized environment.

You can test the postgres-fips image by running the following command:

docker run --rm -e POSTGRES_PASSWORD=password -ti --name postgres-test cgr.dev/ORGANIZATION/postgres-fips:<version>

Note that the only environment variable required by the postgres-fips container image is POSTGRES_PASSWORD.

This command will run the Image, but no data within the PostgreSQL database will persist after the Image stops running. To persist PostgreSQL data you can mount a volume mapped to the container's data folder:

docker run --rm -v $PWD/data:/var/lib/postgresql/data -e POSTGRES_PASSWORD=password -ti --name postgres-test cgr.dev/ORGANIZATION/postgres-fips:<version>

In a new terminal, exec into the running container:

docker exec -ti postgres-test bash

Connect using the postgres user:

su postgres

Use the createdb wrapper to create a test database:

createdb test

Then use the PostgreSQL client to Connect to the new database:

psql test

From there you can interact with the database as you would with any other PostgreSQL database. For instance, you can create a sample table:

CREATE TABLE accounts (
	user_id serial PRIMARY KEY,
	username VARCHAR ( 50 ) UNIQUE NOT NULL,
	password VARCHAR ( 50 ) NOT NULL,
	email VARCHAR ( 255 ) UNIQUE NOT NULL,
	created_on TIMESTAMP NOT NULL,
	last_login TIMESTAMP
);

You could then insert data into the table:

INSERT INTO accounts (username, password, email, created_on, last_login)
VALUES (
'Inky',
'p@$$w0rD',
'inky@example.com',
'2017-07-23',
'2017-07-23'
);

You can also use all of PostgreSQL's internal meta-commands. For example, \dt will list all the tables stored within the database:

\dt
          List of relations
 Schema |   Name   | Type  |  Owner
--------+----------+-------+----------
 public | accounts | table | postgres
(1 row)

Customizing PostgreSQL with environment variables

You can extend Chainguard's Postgres image with environment variables. Chainguard's Postgres image is compatible with the environment variables available in the official PostgreSQL image, including the following:

  • PGDATA: This variable allows you to define another location for database files. The default data directory is /var/lib/postgresql/data.
  • POSTGRES_PASSWORD: This environment variable sets the superuser password for PostgreSQL. This variable is required to use the Postgres image.
  • POSTGRES_USER: This is used with the POSTGRES_PASSWORD variable to set a superuser for the database and its password. If not specified, you can use the default postgres user.
  • POSTGRES_DB: Using this variable allows you to set a different name for the default database. If not specified, the default database will be postgres or the value set by POSTGRES_USER.
  • POSTGRES_INITDB_ARGS: This variable allows you to send arguments to postgres initdb.
  • POSTGRES_INITDB_WALDIR: You can set this variable to define the location for the PostgreSQL transaction log. By default, the transaction log is stored in a subdirectory of the main PostgresSQL data folder, which you can define with PGDATA.
  • POSTGRES_HOST_AUTH_METHOD: This variable allows you to control the auth-method used to authenticate when connecting to the database.

Note that if you set the POSTGRES_HOST_AUTH_METHOD variable to trust, then the POSTGRES_PASSWORD variable is no longer required:

docker run --rm -e POSTGRES_HOST_AUTH_METHOD=trust -e POSTGRES_DB=linky -ti --name postgres-test cgr.dev/ORGANIZATION/postgres-fips:latest

Additionally, be aware that the Docker specific variables will only have an effect if you start the container with an empty data directory; pre-existing databases won't be affected on container startup.

Running PostgreSQL with a custom configuration file

You can also run the Chainguard Postgres image with a custom configuration file. The following example will mount a PostgreSQL configuration file named my-postgres.conf to the container.

docker run --rm -v "$PWD/my-postgres.conf":/etc/postgresql/postgresql.conf -e POSTGRES_PASSWORD=password -ti --name postgres-test cgr.dev/ORGANIZATION/postgres-fips:latest -c 'config_file=/etc/postgresql/postgresql.conf'

This command also uses the postgres server's -c flag to set the config_file runtime parameter.

Documentation and Resources

What are Chainguard Containers?

Chainguard Containers are minimal container images that are secure by default.

In many cases, the Chainguard Containers tagged as :latest contain only an open-source application and its runtime dependencies. These minimal container images typically do not contain a shell or package manager. Chainguard Containers are built with Wolfi, our Linux undistro designed to produce container images that meet the requirements of a more secure software supply chain.

The main features of Chainguard Containers include:

For cases where you need container images with shells and package managers to build or debug, most Chainguard Containers come paired with a -dev variant.

Although the -dev container image variants have similar security features as their more minimal versions, they feature additional software that is typically not necessary in production environments. We recommend using multi-stage builds to leverage the -dev variants, copying application artifacts into a final minimal container that offers a reduced attack surface that won’t allow package installations or logins.

Learn More

To better understand how to work with Chainguard Containers, please visit Chainguard Academy and Chainguard Courses.

In addition to Containers, Chainguard offers VMs and Libraries. Contact Chainguard to access additional products.

Trademarks

This software listing is packaged by Chainguard. The trademarks set forth in this offering are owned by their respective companies, and use of them does not imply any affiliation, sponsorship, or endorsement by such companies.

Licenses

Chainguard container images contain software packages that are direct or transitive dependencies. The following licenses were found in the "latest" tag of this image:

  • Apache-2.0

  • BSD-1-Clause

  • BSD-2-Clause

  • BSD-3-Clause

  • BSD-4-Clause-UC

  • CC-PDDC

  • GCC-exception-3.1

For a complete list of licenses, please refer to this Image's SBOM.

Software license agreement

Compliance

This is a FIPS validated image for FedRAMP compliance.

This image is STIG hardened and scanned against the DISA General Purpose Operating System SRG with reports available.

Learn more about STIGsGet started with STIGs

Related images
postgres logo
postgres

Category
FIPS
STIG

Safe Source for Open Sourceâ„¢
Contact us
© 2025 Chainguard. All Rights Reserved.
Private PolicyTerms of Use

Chainguard ContainersChainguard LibrariesChainguard VMs