Deploying IvorySQL with Docker and Podman
|
Besides Docker Hub, the IvorySQL community provides a Harbor registry for users in China. Replace the registry prefix in this chapter with |
1. Image and listening ports
The official image ivorysql/ivorysql uses 5.6-ubi8 as its main tag; 5.6-bookworm and 5.6-trixie are variants built on other base images with the same functionality. The image declares three ports:
| Port | Purpose | Notes |
|---|---|---|
|
PostgreSQL-compatible listener |
Sessions connected on this port see |
|
Oracle-compatible listener |
Sessions connected on this port see |
|
Temporary init port |
Used only inside the container while it initializes; not a service port, no need to publish it |
The data directory is pinned by the image environment variable PGDATA to /var/local/ivorysql/ivorysql-5/data and declared as an anonymous volume. For production, use a named volume instead, as described in "Data persistence" below.
2. Running with Docker
2.2. Start a container
IVORYSQL_PASSWORD is required: it sets the password of the superuser created during initialization. Without it the container exits immediately (exit code 1) and logs:
Error: Database is uninitialized and superuser password is not specified.
You must specify IVORYSQL_PASSWORD to a non-empty value for the
superuser. For example, "-e IVORYSQL_PASSWORD=password" on "docker run".
You may also use "POSTGRES_HOST_AUTH_METHOD=trust" to allow all
connections without a password. This is *not* recommended.
The command below does four things at once: set the password, put the data directory on a named volume, publish both listeners, and add a health check:
$ docker run -d --name ivorysql \
-e IVORYSQL_PASSWORD=your_password \
-v ivorysql_data:/var/local/ivorysql/ivorysql-5/data \
-p 1521:1521 -p 5433:5432 \
--health-cmd "pg_isready -p 1521 -U ivorysql" \
--health-interval 10s --health-timeout 5s --health-retries 5 \
ivorysql/ivorysql:5.6-ubi8
Here the container’s 1521 is published on host 1521 and the container’s 5432 on host 5433, so it does not collide with a local PostgreSQL. Adjust the host ports as needed.
2.3. Startup log
A healthy container logs both listeners:
server started
2026-11-11 16:15:19.039 UTC [1] LOG: starting PostgreSQL 18.6 (IvorySQL 5.6) on x86_64-pc-linux-gnu, compiled by gcc (GCC) 8.5.0 20210514 (Red Hat 8.5.0-28), 64-bit
2026-11-11 16:15:19.039 UTC [1] LOG: listening on IPv4 address "0.0.0.0", port 5432
2026-11-11 16:15:19.039 UTC [1] LOG: listening on IPv6 address "::", port 5432
2026-11-11 16:15:19.042 UTC [1] LOG: listening on IPv4 address "0.0.0.0", port 1521
2026-11-11 16:15:19.042 UTC [1] LOG: listening on IPv6 address "::", port 1521
2026-11-11 16:15:19.044 UTC [1] LOG: listening on Unix socket "/tmp/.s.PGSQL.5432"
2026-11-11 16:15:19.049 UTC [1] LOG: listening on Unix socket "/tmp/.s.PGSQL.1521"
2026-11-11 16:15:19.064 UTC [1] LOG: database system is ready to accept connections
2.4. Port mapping
$ docker port ivorysql
1521/tcp -> 0.0.0.0:11521
1521/tcp -> [::]:11521
5432/tcp -> 0.0.0.0:15532
5432/tcp -> [::]:15532
(The output above comes from a run that published the container ports on 11521 and 15532; with the command in the previous section it shows 1521 and 5433 instead.)
2.5. Environment variables
| Variable | Default | Notes |
|---|---|---|
|
none (required) |
Superuser password; the container exits when it is missing |
|
|
Superuser name created during initialization |
|
same as |
Database name created during initialization |
|
none |
Extra arguments passed to |
|
none |
Set to |
During the first initialization, *.sql files mounted under /docker-entrypoint-initdb.d/ are executed automatically, which is convenient for creating databases, tables, or seeding data.
2.6. Data persistence
The container writes its data into PGDATA (/var/local/ivorysql/ivorysql-5/data); without a volume, removing the container loses the data. With a named volume, restarts and container rebuilds keep it:
$ docker restart ivorysql
$ psql -h 127.0.0.1 -p 1521 -U ivorysql -d postgres -c "select id, note from t_vol;"
id | note
----+------
1 | ok
(1 row)
docker volume inspect shows where the volume really lives on the host:
$ docker volume inspect ivorysql_data
"Mountpoint": "/var/lib/docker/volumes/ivorysql_data/_data",
"Driver": "local",
After mounting, the PGDATA directory contains PG_VERSION (with 18 inside), ivorysql.conf, pg_hba.conf and the rest of the cluster files.
2.7. Health check
The image has no ss, netstat, or ps (running ps returns ps: command not found), so do not build a health check on ss -lntp or curl. Use the bundled pg_isready instead; both listeners answer it:
/var/local/ivorysql/ivorysql-5/bin/pg_isready -p 5432 → /tmp:5432 - accepting connections rc=0
/var/local/ivorysql/ivorysql-5/bin/pg_isready -p 1521 → /tmp:1521 - accepting connections rc=0
3. One container, two ports, two compatibility modes
This is where the IvorySQL image surprises people most: the same container and the same data are Oracle-compatible when you connect on 1521 and PostgreSQL-compatible when you connect on 5432.
$ psql -h 127.0.0.1 -p 5433 -U ivorysql -d postgres -At \
-c "select current_setting('ivorysql.port') as ivory, current_setting('ivorysql.compatible_mode') as mode, current_setting('server_version') as ver"
1521|pg|18.6
$ psql -h 127.0.0.1 -p 1521 -U ivorysql -d postgres -At -c "<the same query>"
1521|oracle|18.6
Comparing the ivorysql.* parameters in pg_settings, only ivorysql.compatible_mode differs among the eight entries:
# 1521 listener
ivorysql.compatible_mode=oracle
ivorysql.database_mode=oracle
ivorysql.datetime_ignore_nls_mask=0
ivorysql.enable_case_switch=on
ivorysql.enable_emptystring_to_NULL=on
ivorysql.identifier_case_switch=interchange
ivorysql.listen_addresses=*
ivorysql.port=1521
# 5432 listener
ivorysql.compatible_mode=pg
(the other 7 entries are identical)
Note that ivorysql.database_mode stays oracle on both connections: it records the mode chosen when the database was created and does not change with the port. What changes is the set of semantics the current session parses SQL with.
So an Oracle-style table can be created directly on the Oracle listener, and both ports can then read it:
create table if not exists t_vol(id int primary key, note varchar2(20));
insert into t_vol values (1, 'ok');
select id, note from t_vol;
id | note
----+------
1 | ok
(1 row)
The container initializes in Oracle mode because that is the default of initdb itself (-m, --dbmode=MODE set database mode, default is oracle) and the entrypoint does not pass -m. To initialize in PostgreSQL mode instead, pass -e POSTGRES_INITDB_ARGS="-m pg".
4. Running with Podman
The Podman command line matches Docker, so replace docker with podman:
$ podman pull ivorysql/ivorysql:5.6-ubi8
$ podman run -d --name ivorysql \
-e IVORYSQL_PASSWORD=your_password \
-v ivorysql_data:/var/local/ivorysql/ivorysql-5/data \
-p 1521:1521 -p 5433:5432 \
ivorysql/ivorysql:5.6-ubi8
$ podman ps --filter name=ivorysql
Once the container is up, verify it the same way as with Docker, either from inside the container or from the host:
$ podman exec -it ivorysql psql -U ivorysql -d postgres -c "select version();"
$ psql -h 127.0.0.1 -p 1521 -U ivorysql -d postgres # Oracle-compatible
$ psql -h 127.0.0.1 -p 5433 -U ivorysql -d postgres # PostgreSQL-compatible
5. Troubleshooting
-
The container exits right after starting:
docker logs ivorysqlshowsDatabase is uninitialized and superuser password is not specified., meaning-e IVORYSQL_PASSWORDwas omitted. -
Nothing answers on
1521: thePORTScolumn ofdocker pslists only5432/tcp, so1521was never published; add-p 1521:1521. -
Host port
1521is already taken: publish another host port, for example-p 11521:1521; the container still listens on1521. -
5866/tcpis listed but refuses connections: it is the temporary init port, used only inside the container during initialization and never published.