polardb/polardb_pg_devel:${tag} provides runtime environment and compilation dependencies for PolarDB-PG. According to the base OS being used, it includes following tags:
polardb/polardb_pg_binary:${tag} is based on polardb/polardb_pg_devel:22.04, providing latest binary built from stable branch of PolarDB-PG. This image is enough for running PolarDB-PG.
Local Instance Image
polardb/polardb_pg_local_instance:${tag} is based on polardb/polardb_pg_binary:${tag}, with an entrypoint for initializing and starting-up PolarDB-PG instance on local file system.
Without Data Persistence
Simply try without persisting data directories. It will initialize database inside the container and start the database up. Override Docker CMD of image with psql to connect to the database:
$ docker run -it --rm polardb/polardb_pg_local_instance:15 psql
...
psql (PostgreSQL 15.8 (PolarDB 15.8.2.0 build unknown) on x86_64-linux-gnu)
Type "help" for help.
postgres=#
If you don’t want to get into psql, simply override Docker CMD with other command:
Use an empty local directory as a volume, and mount the volume when creating the container. The container entry point will try to initdb in this volume. ${your_data_dir} should be empty for the first time. If the volume is not empty, the entry point will regard the volume as already been initialized, and will start-up the database instance from the volume. The volume must be mounted under /var/polardb/ inside container:
For those who want to use PolarDB-PG as a daemon service, the container can be created with -d option:
docker run -d \
-v ${your_data_dir}:/var/polardb \
polardb/polardb_pg_local_instance:15
Exposing Ports
For those who want to export ports to host machine, use POLARDB_PORT environment variable to specify ports. Typically, PolarDB-PG needs three continuous unused ports. Use -p option to expose these ports, e.g. 5432-5434:
PolarDB-PG Images
Runtime/Development Image
polardb/polardb_pg_devel:${tag}provides runtime environment and compilation dependencies for PolarDB-PG. According to the base OS being used, it includes following tags:ubuntu24.04: useubuntu:24.04as base OSubuntu22.04: useubuntu:22.04as base OSubuntu20.04: useubuntu:20.04as base OSdebian12: usedebian:12as base OSdebian11: usedebian:11as base OSrocky9: userockylinux:9as base OSrocky8: userockylinux:8as base OSanolis8: useopenanolis/anolisos:8.6as base OScentos7(DEPRECATED): usecentos:centos7as base OSBinary Image
polardb/polardb_pg_binary:${tag}is based onpolardb/polardb_pg_devel:22.04, providing latest binary built from stable branch of PolarDB-PG. This image is enough for running PolarDB-PG.Local Instance Image
polardb/polardb_pg_local_instance:${tag}is based onpolardb/polardb_pg_binary:${tag}, with an entrypoint for initializing and starting-up PolarDB-PG instance on local file system.Without Data Persistence
Simply try without persisting data directories. It will initialize database inside the container and start the database up. Override Docker
CMDof image withpsqlto connect to the database:If you don’t want to get into
psql, simply override DockerCMDwith other command:With Data Persistence
Use an empty local directory as a volume, and mount the volume when creating the container. The container entry point will try to initdb in this volume.
${your_data_dir}should be empty for the first time. If the volume is not empty, the entry point will regard the volume as already been initialized, and will start-up the database instance from the volume. The volume must be mounted under/var/polardb/inside container:Running as Daemon
For those who want to use PolarDB-PG as a daemon service, the container can be created with
-doption:Exposing Ports
For those who want to export ports to host machine, use
POLARDB_PORTenvironment variable to specify ports. Typically, PolarDB-PG needs three continuous unused ports. Use-poption to expose these ports, e.g.5432-5434:Or directly use
--network=hostto share network with host machine:Environment Variables
POLARDB_PORT: the port on which primary node will be running; two replica nodes will be running at${POLARDB_PORT}+1and${POLARDB_PORT}+2POLARDB_USER: the default superuser to be created during initializationPOLARDB_PASSWORD: the default password to be used byPOLARDB_USERorpostgres