PostgreSQL is an open source object-relational database. Long-term versions maintained by Canonical.
500K+
Current postgres Docker Image from Canonical, based on Ubuntu. Receives security updates and rolls to newer postgres or Ubuntu release. This repository is free to use and exempt from per-user rate limits.
Current PostgreSQL software Docker Image from Canonical based on Ubuntu. Receives security updates and rolls to newer PostgreSQL software or Ubuntu release. This repository is free to use and exempted from per-user rate limits.
PostgreSQL is a powerful, open source object-relational database system. It has more than 20 years of active development and a proven architecture that has earned it a strong reputation for reliability, data integrity, and correctness. Read more on the PostgreSQL website.
docker run --detach --name postgresql-container -p 30432:5432 -e TZ=UTC -e POSTGRES_PASSWORD=My:S3cr3t ubuntu/postgres:16-24.04_edge
Up to 5 years of free security maintenance on LTS channels.
Up to 10 years of customer security maintenance from Canonical's restricted repositories.
| Channel Tags | Supported until | Currently | Architectures | |
|---|---|---|---|---|
14-22.04_beta | 14-22.04_edge, edge, latest | - | postgres 14 on Ubuntu 22.04 LTS | s390x, amd64, ppc64le, arm64 |
13-21.10_beta | 13-21.10_edge | - | postgres 13 on Ubuntu 21.10 | amd64, s390x, arm64, ppc64le |
13-21.04_beta | 13-21.04_edge | - | postgres 13 on Ubuntu 21.04 | s390x, ppc64le, amd64, arm64 |
12-20.04_beta | 12-20.04_edge | - | postgres 12 on Ubuntu 20.04 LTS | s390x, arm64, ppc64le, amd64 |
16-24.04_edge | 16-24.04_edge | - | postgres 16 on Ubuntu 24.04 LTS | amd64, arm64 |
track_risk |
Channel Tags shows the most stable channel for that track ordered stable, candidate, beta, edge. More risky channels are always implicitly available. So if beta is listed, you can also pull edge. If candidate is listed, you can pull beta and edge. When stable is listed, all four are available. Images are guaranteed to progress through the sequence edge, beta, candidate before stable.
If your usage includes commercial redistribution, or requires ESM or unavailable channels/versions, please get in touch with the Canonical team (or using [email protected]).
Launch this image locally:
docker run -d --name postgres-container -e TZ=UTC -e TZ=UTC -e POSTGRES_PASSWORD=My:S3cr3t -p 30432:5432 ubuntu/postgres:14-22.04_beta
Access your PostgreSQL server at localhost:55432.
| Parameter | Description |
|---|---|
-e TZ=UTC | Timezone. |
-e POSTGRES_PASSWORD=my_secret_password | Set the password for the superuser which is postgres by default. Bear in mind that to connect to the database in the same host the password is not needed but to access it via an external host (for instance another container) the password is needed. This option is mandatory and must not be empty. |
-e POSTGRES_USER=john | Create a new user with superuser privileges. This is used in conjunction with POSTGRES_PASSWORD. |
-e POSTGRES_DB=db_test | Set the name of the default database. |
-e POSTGRES_INITDB_ARGS="--data-checksums" | Pass arguments to the postgres initdb call. |
-e POSTGRES_INITDB_WALDIR=/path/to/location | Set the location of the Postgres transaction log. By default it is stored in a subdirectory of the main Postgres data folder (PGDATA). |
-e POSTGRES_HOST_AUTH_METHOD=trust | Set the auth-method for host connections for all databases, all users, and all addresses. The following will be added to the pg_hba.conf if this option is passed 'host all all all $POSTGRES_HOST_AUTH_METHOD'. |
-e PGDATA=/path/to/location | Set the location of the database files. The default is '/var/lib/postgresql/data'. |
-p 30432:5432 | Expose Postgres on localhost:30432. |
-v /path/to/postgresql.conf:/etc/postgresql/postgresql.conf | Local configuration file 'postgresql.conf'. |
-v /path/to/persisted/data:/var/lib/postgresql/data | Persist data instead of initializing a new database every time you launch a new container. |
To debug the container:
docker logs -f postgres-container
To get an interactive shell:
docker exec -it postgres-container /bin/bash
To debug the container:
docker logs -f postgresql-container
docker exec -it postgresql-container pebble logs
To get an interactive shell:
docker exec -it postgresql-container /bin/bash
If you find a bug in our image or want to request a specific feature, please file a bug here:
https://bugs.launchpad.net/ubuntu-docker-images/+filebug
Please title the bug "postgres: <issue summary>". Make sure to include the digest of the image you are using, from:
docker images --no-trunc --quiet ubuntu/postgres:<tag>
These channels (tags) are not updated anymore. Please upgrade to newer channels, or reach out if you can't upgrade.
| Track | Version | EOL | Upgrade Path |
|---|---|---|---|
track |
Content type
Image
Digest
sha256:d8a369b24…
Size
200.1 MB
Last updated
about 22 hours ago
Requires Docker Desktop 4.37.1 or later.
Pulls:
3,142
Last week