PostgreSQL
Coolify deploys PostgreSQL as a standalone container on the selected server and destination. A new resource gets a generated password, a persistent data volume, an internal connection URL, and a health check.
PostgreSQL is an object-relational database for transactional workloads, relational data, and extensions.
Create a PostgreSQL database
Open New Resource
Open the project and environment where the database should live, then select New Resource.
Select PostgreSQL
Under Databases, select PostgreSQL. You can also search for PostgreSQL by name.
Select a server
Select the server that should run PostgreSQL. Build servers cannot be selected because they do not host running database resources.
Select a destination
Select the Docker network destination that PostgreSQL should join.
Select a PostgreSQL type
Choose the PostgreSQL image that matches your required major version and extensions. Use the standard PostgreSQL option unless the database needs an offered extension image.
Review the generated configuration
Coolify creates the resource and opens Configuration > General. Review the image, username, generated password, initial database, and connection URLs. Keep the default private networking unless an external client requires access.
Start PostgreSQL
Select Start and follow the startup output. Wait until PostgreSQL is running and healthy, then copy the Internal URL into applications on the same destination network.
Default configuration
| Setting | Default or behavior |
|---|---|
| Internal port | 5432 |
| Default image selection | PostgreSQL 18 (postgres:18-alpine) |
| Username | postgres |
| Initial database | postgres |
| Data mount | PostgreSQL 17 and earlier: /var/lib/postgresql/data; PostgreSQL 18 and later: /var/lib/postgresql |
| Scheduled backups | Supported |
| SSL | Supported with PostgreSQL SSL modes |
Coolify's PostgreSQL selector includes PostgreSQL 18, 17, and 16 images, plus Supabase PostgreSQL, PostGIS, and PGVector extension images. Select the image that matches the extensions, architecture, and major version your application requires.
The password is generated when the resource is created. If you change the username, password, or initial database in the running database outside Coolify, update the matching values in Configuration > General so connection URLs and automated backups continue to work.
Connect to PostgreSQL
Use the Internal URL for an application on the same Coolify destination network:
postgres://<username>:<password>@<database-container>:5432/<database>When Make it publicly available is enabled, Coolify also shows a Public URL using the server address and Public Port. Do not expose port 5432 unless an external client requires it; prefer private networking for application connections.
Read Databases for port mappings, the public TCP proxy, and firewall considerations.
Configure PostgreSQL
Open Configuration > General, then use the section that matches the setting you need to change.
Resource details
Use Name and Description to identify the resource in Coolify. Image controls the PostgreSQL image used when Coolify creates the container.
Database credentials
Username, Password, and Initial Database determine the generated connection URLs and the values used by Coolify's database operations. If you change the corresponding values inside PostgreSQL, keep the fields in Coolify synchronized.
Changing the image, port mapping, configuration, or health check marks the resource as changed. Restart the database to recreate the container with the new generated Compose configuration.
Back up and restore PostgreSQL
Coolify's scheduled backup job uses pg_dump in custom format for selected databases:
pg_dump --format=custom --no-acl --no-ownerWhen Backup All Databases is enabled, Coolify uses pg_dumpall and stores a gzip-compressed dump. Configure the schedule, retention, and S3 destination in Database backups. Follow Restore a database for the built-in PostgreSQL import workflow.
The built-in Import Backup form accepts PostgreSQL backups while the database is running. A custom-format dump is restored with pg_restore; a plain SQL dump requires a matching custom import command such as psql.
A custom-format dump is not a plain .sql file. Use pg_restore for a custom-format file and psql for plain SQL. Review the command before restoring because the restore replaces data in the target database.
SSL and health checks
PostgreSQL supports allow, prefer, require, verify-ca, and verify-full. The last two modes require the client to trust the Coolify CA certificate. See Database SSL.
The default health check runs inside the PostgreSQL container. Configure its interval, timeout, retries, and start period under Configuration > Healthcheck, then restart PostgreSQL to apply changes.
