Introducing our new CEO Don Johnson - Read More

google/alloydbomni

Verified Publisher

By Google

Updated 3 months ago

Run AlloyDB in your data center, on your laptop, at the edge, and in any cloud.

Image
Databases & Storage
5

100K+

Quick reference

AlloyDB Omni Overview

Supported Architecture

amd64, arm64v8

What is AlloyDB Omni?

AlloyDB Omni is a downloadable database software package that lets you deploy a streamlined edition of AlloyDB for PostgreSQL in your own computing environment. While being 100% compatible with PostgreSQL applications and tools, AlloyDB Omni delivers higher performance for both OLTP and OLAP workloads and makes administration easy with a number of autopilots. AlloyDB AI provides powerful tools to build generative AI applications with the ability to create, store, and index vector embeddings right in your database. The portability of AlloyDB Omni lets it run in a wide variety of environments, including the following:

  • Datacenters
  • Laptops
  • Cloud-based VM instances

AlloyDB Omni is well-suited to the following scenarios:

  • You need a scalable and performant version of PostgreSQL, but you can't run a database in the cloud due to regulatory or data-sovereignty requirements.
  • You need a database that keeps running even when it is disconnected from the internet.
  • You want to physically locate your database as close as possible your users, in order to minimize latency.
  • You would like a way to migrate away from a legacy database, but without committing to a full cloud migration.

If you want to upgrade your project to the fully managed scaling, security, and availability features of AlloyDB, you can migrate your AlloyDB Omni data into an AlloyDB cluster just as you can with any other initial data import. For more details refer to the Documentation

NOTE: The ARM version of this image is in preview and is not recommended or supported for production use.

How to use this image

Start an AlloyDB Omni instance

$ docker run --name my-omni -e POSTGRES_PASSWORD=mysecretpassword -d google/alloydbomni

The default postgres user and database are created in the entrypoint with initdb. The above command sets password as mysecretpassword, please choose your own secure password.

Connect to the instance via psql in AlloyDB Omni container

$ docker exec -it my-omni psql -U postgres                       
psql (15.5)
Type "help" for help.

postgres=# SELECT 1;
 ?column? 
----------
        1
(1 row)

Environment Variables

The PostgreSQL image uses several environment variables which are easy to miss. The only variable required is POSTGRES_PASSWORD, the rest are optional.

Warning: the Docker specific variables will only have an effect if you start the container with a data directory that is empty; any pre-existing database will be left untouched on container startup.

POSTGRES_PASSWORD

This environment variable is required for you to use the PostgreSQL image. It must not be empty or undefined. This environment variable sets the superuser password for PostgreSQL. The default superuser is defined by the POSTGRES_USER environment variable.

Note 1: The PostgreSQL image sets up trust authentication locally so you may notice a password is not required when connecting from localhost (inside the same container). However, a password will be required if connecting from a different host/container.

Note 2: This variable defines the superuser password in the PostgreSQL instance, as set by the initdb script during initial container startup. It has no effect on the PGPASSWORD environment variable that may be used by the psql client at runtime, as described at https://www.postgresql.org/docs/15/libpq-envars.html. PGPASSWORD, if used, will be specified as a separate environment variable.

POSTGRES_USER

This optional environment variable is used in conjunction with POSTGRES_PASSWORD to set a user and its password. This variable will create the specified user with superuser power and a database with the same name. If it is not specified, then the default user of postgres will be used.

POSTGRES_DB

This optional environment variable can be used to define a different name for the default database that is created when the image is first started. If it is not specified, then the value of POSTGRES_USER will be used.

POSTGRES_INITDB_ARGS

This optional environment variable can be used to send arguments to initdb. The value is a space separated string of arguments as initdb would expect them. This is useful for adding functionality like data page checksums: -e POSTGRES_INITDB_ARGS="--data-checksums".

POSTGRES_INITDB_WALDIR

This optional environment variable can be used to define another location for the AlloyDB Omni transaction log. By default the transaction log is stored in a subdirectory of the main AlloyDB Omni data folder (PGDATA). Sometimes it can be desirable to store the transaction log in a different directory which may be backed by storage with different performance or reliability characteristics.

POSTGRES_HOST_AUTH_METHOD

This optional variable can be used to control the auth-method for host connections for all databases, all users, and all addresses. If unspecified then scram-sha-256 password authentication is used (in 14+; md5 in older releases). On an uninitialized database, this will populate pg_hba.conf via this approximate line:

echo "host all all all $POSTGRES_HOST_AUTH_METHOD" >> pg_hba.conf

See the documentation on pg_hba.conf for more information about possible values and their meanings.

PGDATA

Important Note: when mounting a volume to /var/lib/postgresql, the /var/lib/postgresql/data path is a local volume from the container runtime, thus data is not persisted on the mounted volume.

This optional variable can be used to define another location - like a subdirectory - for the database files. The default is /var/lib/postgresql/data. If the data volume you're using is a filesystem mountpoint (like with GCE persistent disks), or remote folder that cannot be chowned to the postgres user (like some NFS mounts), or contains folders/files (e.g. lost+found), Postgres initdb requires a subdirectory to be created within the mountpoint to contain the data.

For example:

$ docker run -d \
	--name some-postgres \
	-e POSTGRES_PASSWORD=mysecretpassword \
	-e PGDATA=/var/lib/postgresql/data/pgdata \
	-v /custom/mount:/var/lib/postgresql/data \
	my-omni

Please specify your own mount point instead of /custom/mount/ while using above command.

License

AlloyDB Omni Terms of Service

Third Party Notices

The instructions above were adapted from The PostgreSQL official image instructions given that AlloyDB Omni is PostgreSQL compatible.

Docker Pull Command

docker pull google/alloydbomni