bitnami/postgresqlPostgreSQL (Postgres) is an open source object-relational database known for reliability and data integrity. ACID-compliant, it supports foreign keys, joins, views, triggers and stored procedures.
Overview of PostgreSQL Trademarks: This software listing is packaged by Bitnami. The respective trademarks mentioned in the offering are owned by the respective companies, and use of them does not imply any affiliation or endorsement.
consoledocker run --name postgresql bitnami/postgresql:latest
Warning: This quick setup is only intended for development environments. You are encouraged to change the insecure default credentials and check out the available configuration options in the Configuration section for a more secure deployment.
Those are hardened, minimal CVE images built and maintained by Bitnami. Bitnami Secure Images are based on the cloud-optimized, security-hardened enterprise OS Photon Linux. Why choose BSI images?
Each image comes with valuable security metadata. You can view the metadata in our public catalog here. Note: Some data is only available with commercial subscriptions to BSI.
!Alt text !Alt text
If you are looking for our previous generation of images based on Debian Linux, please see the Bitnami Legacy registry.
Deploying Bitnami applications as Helm Charts is the easiest way to get started with our applications on Kubernetes. Read more about the installation in the Bitnami PostgreSQL Chart GitHub repository.
Non-root container images add an extra layer of security and are generally recommended for production environments. However, because they run as a non-root user, privileged tasks are typically off-limits. Learn more about non-root containers in our docs.
Dockerfile linksLearn more about the Bitnami tagging policy and the difference between rolling tags and immutable tags in our documentation page.
You can see the equivalence between the different tags by taking a look at the tags-info.yaml file present in the branch folder, i.e bitnami/ASSET/BRANCH/DISTRO/tags-info.yaml.
Subscribe to project updates by watching the bitnami/containers GitHub repo.
The recommended way to get the Bitnami PostgreSQL Docker Image is to pull the prebuilt image from the Docker Hub Registry.
consoledocker pull bitnami/postgresql:latest
To use a specific version, you can pull a versioned tag. You can view the list of available versions in the Docker Hub Registry.
consoledocker pull bitnami/postgresql:[TAG]
If you wish, you can also build the image yourself by cloning the repository, changing to the directory containing the Dockerfile and executing the docker build command. Remember to replace the APP, VERSION and OPERATING-SYSTEM path placeholders in the example command below with the correct values.
consolegit clone [***] cd bitnami/APP/VERSION/OPERATING-SYSTEM docker build -t bitnami/APP:latest .
If you remove the container all your data and configurations will be lost, and the next time you run the image the database will be reinitialized. To avoid this loss of data, you should mount a volume that will persist even after the container is removed.
For persistence you should mount a directory at the /bitnami/postgresql path. If the mounted directory is empty, it will be initialized on the first run.
consoledocker run \ -v /path/to/postgresql-persistence:/bitnami/postgresql \ bitnami/postgresql:latest
or by modifying the docker-compose.yml file present in this repository:
yamlservices: postgresql: ... volumes: - /path/to/postgresql-persistence:/bitnami/postgresql ...
NOTE: As this is a non-root container, the mounted files and directories must have the proper permissions for the UID
1001.
Using Docker container networking, a PostgreSQL server running inside a container can easily be accessed by your application containers.
Containers attached to the same network can communicate with each other using the container name as the hostname.
In this example, we will create a PostgreSQL client instance that will connect to the server instance that is running on the same docker network as the client.
consoledocker network create app-tier --driver bridge
Use the --network app-tier argument to the docker run command to attach the PostgreSQL container to the app-tier network.
consoledocker run -d --name postgresql-server \ --network app-tier \ bitnami/postgresql:latest
Finally we create a new container instance to launch the PostgreSQL client and connect to the server created in the previous step:
consoledocker run -it --rm \ --network app-tier \ bitnami/postgresql:latest psql -h postgresql-server -U postgres
When not specified, Docker Compose automatically sets up a new network and attaches all deployed services to that network. However, we will explicitly define a new bridge network named app-tier. In this example we assume that you want to connect to the PostgreSQL server from your own custom application image which is identified in the following snippet by the service name myapp.
yamlversion: '2' networks: app-tier: driver: bridge services: postgresql: image: bitnami/postgresql:latest networks: - app-tier myapp: image: YOUR_APPLICATION_IMAGE networks: - app-tier
IMPORTANT:
- Please update the YOUR_APPLICATION_IMAGE_ placeholder in the above snippet with your application image
- In your application container, use the hostname
postgresqlto connect to the PostgreSQL server
Launch the containers using:
consoledocker-compose up -d
| Name | Description | Default Value |
|---|---|---|
POSTGRESQL_VOLUME_DIR | Persistence base directory | /bitnami/postgresql |
POSTGRESQL_DATA_DIR | PostgreSQL data directory | ${POSTGRESQL_VOLUME_DIR}/data |
POSTGRESQL_EXTRA_FLAGS | Extra flags for PostgreSQL initialization | nil |
POSTGRESQL_INIT_MAX_TIMEOUT | Maximum initialization waiting timeout | 60 |
POSTGRESQL_PGCTLTIMEOUT | Maximum waiting timeout for pg_ctl commands | 60 |
POSTGRESQL_SHUTDOWN_MODE | Default mode for pg_ctl stop command | fast |
POSTGRESQL_CLUSTER_APP_NAME | Replication cluster default application name | walreceiver |
POSTGRESQL_DATABASE | Default PostgreSQL database | postgres |
POSTGRESQL_INITDB_ARGS | Optional args for PostreSQL initdb operation | nil |
ALLOW_EMPTY_PASSWORD | Allow password-less access | no |
POSTGRESQL_INITDB_WAL_DIR | Optional init db wal directory | nil |
POSTGRESQL_MASTER_HOST | PostgreSQL master host (used by slaves) | nil |
POSTGRESQL_MASTER_PORT_NUMBER | PostgreSQL master host port (used by slaves) | 5432 |
POSTGRESQL_NUM_SYNCHRONOUS_REPLICAS | Number of PostgreSQL replicas that should use synchronous replication | 0 |
POSTGRESQL_SYNCHRONOUS_REPLICAS_MODE | PostgreSQL synchronous replication mode (values: empty, FIRST, ANY) | nil |
POSTGRESQL_PORT_NUMBER | PostgreSQL port number | 5432 |
POSTGRESQL_ALLOW_REMOTE_CONNECTIONS | Modify pg_hba settings so users can access from the outside | yes |
POSTGRESQL_REPLICATION_MODE | PostgreSQL replication mode (values: master, slave) | master |
POSTGRESQL_REPLICATION_USER | PostgreSQL replication user | nil |
POSTGRESQL_REPLICATION_USE_PASSFILE | Use PGPASSFILE instead of PGPASSWORD | no |
POSTGRESQL_REPLICATION_PASSFILE_PATH | Path to store passfile | ${POSTGRESQL_CONF_DIR}/.pgpass |
POSTGRESQL_SR_CHECK | Create user on PostgreSQL for Stream Replication Check | no |
POSTGRESQL_SR_CHECK_USERNAME | Stream Replication Check user | sr_check_user |
POSTGRESQL_SR_CHECK_DATABASE | Stream Replication Check database | postgres |
POSTGRESQL_SYNCHRONOUS_COMMIT_MODE | Enable synchronous replication in slaves (number defined by POSTGRESQL_NUM_SYNCHRONOUS_REPLICAS) | on |
POSTGRESQL_FSYNC | Enable fsync in write ahead logs | on |
POSTGRESQL_USERNAME | PostgreSQL default username | postgres |
POSTGRESQL_ENABLE_LDAP | Enable LDAP for PostgreSQL authentication | no |
POSTGRESQL_LDAP_URL | PostgreSQL LDAP server url (requires POSTGRESQL_ENABLE_LDAP=yes) | nil |
POSTGRESQL_LDAP_PREFIX | PostgreSQL LDAP prefix (requires POSTGRESQL_ENABLE_LDAP=yes) | nil |
POSTGRESQL_LDAP_SUFFIX | PostgreSQL LDAP suffix (requires POSTGRESQL_ENABLE_LDAP=yes) | nil |
POSTGRESQL_LDAP_SERVER | PostgreSQL LDAP server (requires POSTGRESQL_ENABLE_LDAP=yes) | nil |
POSTGRESQL_LDAP_PORT | PostgreSQL LDAP port (requires POSTGRESQL_ENABLE_LDAP=yes) | nil |
POSTGRESQL_LDAP_SCHEME | PostgreSQL LDAP scheme (requires POSTGRESQL_ENABLE_LDAP=yes) | nil |
POSTGRESQL_LDAP_TLS | PostgreSQL LDAP tls setting (requires POSTGRESQL_ENABLE_LDAP=yes) | nil |
POSTGRESQL_LDAP_BASE_DN | PostgreSQL LDAP base DN settings (requires POSTGRESQL_ENABLE_LDAP=yes) | nil |
POSTGRESQL_LDAP_BIND_DN | PostgreSQL LDAP bind DN settings (requires POSTGRESQL_ENABLE_LDAP=yes) | nil |
POSTGRESQL_LDAP_BIND_PASSWORD | PostgreSQL LDAP bind password (requires POSTGRESQL_ENABLE_LDAP=yes) | nil |
POSTGRESQL_LDAP_SEARCH_ATTR | PostgreSQL LDAP search attribute (requires POSTGRESQL_ENABLE_LDAP=yes) | nil |
POSTGRESQL_LDAP_SEARCH_FILTER | PostgreSQL LDAP search filter (requires POSTGRESQL_ENABLE_LDAP=yes) | nil |
POSTGRESQL_INITSCRIPTS_USERNAME | Username for the psql scripts included in /docker-entrypoint.initdb | $POSTGRESQL_USERNAME |
POSTGRESQL_PASSWORD | Password for the PostgreSQL created user | nil |
POSTGRESQL_POSTGRES_PASSWORD | Password for the PostgreSQL postgres user | nil |
POSTGRESQL_REPLICATION_PASSWORD | Password for the PostgreSQL replication user | nil |
POSTGRESQL_SR_CHECK_PASSWORD | Password for the Stream Replication Check user | nil |
POSTGRESQL_INITSCRIPTS_PASSWORD | Password for the PostgreSQL init scripts user | $POSTGRESQL_PASSWORD |
POSTGRESQL_ENABLE_TLS | Whether to enable TLS for traffic or not | no |
POSTGRESQL_TLS_CERT_FILE | File containing the certificate for the TLS traffic | nil |
POSTGRESQL_TLS_KEY_FILE | File containing the key for certificate | nil |
POSTGRESQL_TLS_CA_FILE | File containing the CA of the certificate | nil |
POSTGRESQL_TLS_CRL_FILE | File containing a Certificate Revocation List | nil |
POSTGRESQL_TLS_PREFER_SERVER_CIPHERS | Whether to use the server TLS cipher preferences rather than the client | yes |
POSTGRESQL_SHARED_PRELOAD_LIBRARIES | List of libraries to preload at PostgreSQL initialization | pgaudit |
POSTGRESQL_PGAUDIT_LOG | Comma-separated list of actions to log with pgaudit | nil |
POSTGRESQL_PGAUDIT_LOG_CATALOG | Enable pgaudit log catalog (pgaudit.log_catalog setting) | nil |
POSTGRESQL_PGAUDIT_LOG_PARAMETER | Enable pgaudit log parameter (pgaudit.log_parameter setting) | nil |
POSTGRESQL_LOG_CONNECTIONS | Add a log entry per user connection | nil |
POSTGRESQL_LOG_DISCONNECTIONS | Add a log entry per user disconnection | nil |
POSTGRESQL_LOG_HOSTNAME | Log the client host name when accessing | nil |
POSTGRESQL_CLIENT_MIN_MESSAGES | Set log level of errors to send to the client | error |
POSTGRESQL_LOG_LINE_PREFIX | Set the format of the log lines | nil |
POSTGRESQL_LOG_TIMEZONE | Set the log timezone | nil |
POSTGRESQL_TIMEZONE | Set the timezone | nil |
POSTGRESQL_MAX_CONNECTIONS | Set the maximum amount of connections | nil |
POSTGRESQL_TCP_KEEPALIVES_IDLE | Set the TCP keepalive idle time | nil |
POSTGRESQL_TCP_KEEPALIVES_INTERVAL | Set the TCP keepalive interval time | nil |
POSTGRESQL_TCP_KEEPALIVES_COUNT | Set the TCP keepalive count | nil |
POSTGRESQL_STATEMENT_TIMEOUT | Set the SQL statement timeout | nil |
POSTGRESQL_PGHBA_REMOVE_FILTERS | Comma-separated list of strings for removing pg_hba.conf lines (example: md5, local) | nil |
POSTGRESQL_USERNAME_CONNECTION_LIMIT | Set the user connection limit | nil |
POSTGRESQL_POSTGRES_CONNECTION_LIMIT | Set the postgres user connection limit | nil |
POSTGRESQL_WAL_LEVEL | Set the write-ahead log level | replica |
POSTGRESQL_DEFAULT_TOAST_COMPRESSION | Set the postgres default compression | nil |
POSTGRESQL_PASSWORD_ENCRYPTION | Set the passwords encryption method | nil |
POSTGRESQL_DEFAULT_TRANSACTION_ISOLATION | Set transaction isolation | nil |
POSTGRESQL_REPLICATION_NODES | Override value for synchronous_standby_names in postgresql.conf. Should be set if REPMGR_NODE_NAME | nil |
POSTGRESQL_PERFORM_RESTORE | Flag to skip deletion of recovery.signal file to enable native recovery. e.g by using wal-g | no |
POSTGRESQL_AUTOCTL_CONF_DIR | Path to the configuration dir for the pg_autoctl command | ${POSTGRESQL_AUTOCTL_VOLUME_DIR}/.config |
POSTGRESQL_AUTOCTL_MODE | pgAutoFailover node type, valid values [monitor, postgres] | postgres |
POSTGRESQL_AUTOCTL_MONITOR_HOST | Hostname for the monitor component | monitor |
POSTGRESQL_AUTOCTL_HOSTNAME | Hostname by which postgres is reachable | $(hostname --fqdn) |
| Name | Description | Value |
|---|---|---|
POSTGRESQL_BASE_DIR | PostgreSQL installation directory | /opt/bitnami/postgresql |
POSTGRESQL_DEFAULT_CONF_DIR | PostgreSQL configuration directory | $POSTGRESQL_BASE_DIR/conf.default |
POSTGRESQL_CONF_DIR | PostgreSQL configuration directory |
_Note: the README for this container is longer than the DockerHub length limit of 25000, so it has been trimmed. The full README can be found at [***]
探索更多轩辕镜像的使用方法,找到最适合您系统的配置方式
通过 Docker 登录认证访问私有仓库
在 Linux 系统配置镜像服务
在 Docker Desktop 配置镜像
Docker Compose 项目配置
Kubernetes 集群配置 Containerd
K3s 轻量级 Kubernetes 镜像加速
在宝塔面板一键配置镜像
Synology 群晖 NAS 配置
飞牛 fnOS 系统配置镜像
极空间 NAS 系统配置服务
爱快 iKuai 路由系统配置
绿联 NAS 系统配置镜像
QNAP 威联通 NAS 配置
Podman 容器引擎配置
HPC 科学计算容器配置
ghcr、Quay、nvcr 等镜像仓库
无需登录使用专属域名
需要其他帮助?请查看我们的 常见问题Docker 镜像访问常见问题解答 或 提交工单
免费版仅支持 Docker Hub 访问,不承诺可用性和速度;专业版支持更多镜像源,保证可用性和稳定速度,提供优先客服响应。
专业版支持 docker.io、gcr.io、ghcr.io、registry.k8s.io、nvcr.io、quay.io、mcr.microsoft.com、docker.elastic.co 等;免费版仅支持 docker.io。
当返回 402 Payment Required 错误时,表示流量已耗尽,需要充值流量包以恢复服务。
通常由 Docker 版本过低导致,需要升级到 20.x 或更高版本以支持 V2 协议。
先检查 Docker 版本,版本过低则升级;版本正常则验证镜像信息是否正确。
使用 docker tag 命令为镜像打上新标签,去掉域名前缀,使镜像名称更简洁。
来自真实用户的反馈,见证轩辕镜像的优质服务