From 37170cbdc811357f5e4ed23161eeaa2e12c5cb9c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E8=AF=97=E7=84=B1?= <3372848903@qq.com> Date: Wed, 11 Nov 2026 16:38:58 +0000 Subject: [PATCH] docs(containerization): update the docker page for 5.6 and both listeners The docker and podman page still used a 5.0 tag, published only the PostgreSQL port, and pasted a podman transcript from an image that is no longer current. The Oracle-compatible listener appeared in that transcript as an unexplained 1521/tcp, the data directory was never mentioned, and nothing said that IVORYSQL_PASSWORD is required. Rewrite the page against ivorysql/ivorysql:5.6-ubi8: - a table of the three exposed ports (5432 PostgreSQL-compatible, 1521 Oracle-compatible, 5866 only used while the entrypoint initializes the cluster) plus PGDATA; - a docker run with the password, a named volume on PGDATA, both listeners published, and a pg_isready health check (the image has no ss, netstat or ps, so a shell-based check cannot work); - an environment variable table, and volume persistence across restart; - one container, two ports, two compatible modes, with the per-listener settings dump, an Oracle-style table read from both ports, and the POSTGRES_INITDB_ARGS override for the initdb default; - podman commands only: the old page pasted output from an image this revision cannot reproduce, so nothing is pasted now. --- .../docker_podman_deployment.adoc | 278 ++++++++++++++---- .../docker_podman_deployment.adoc | 270 +++++++++++++---- 2 files changed, 422 insertions(+), 126 deletions(-) diff --git a/CN/modules/ROOT/pages/master/containerization/docker_podman_deployment.adoc b/CN/modules/ROOT/pages/master/containerization/docker_podman_deployment.adoc index 2cc7db8a..2e1e9bfe 100644 --- a/CN/modules/ROOT/pages/master/containerization/docker_podman_deployment.adoc +++ b/CN/modules/ROOT/pages/master/containerization/docker_podman_deployment.adoc @@ -1,4 +1,3 @@ - :sectnums: :sectnumlevels: 5 @@ -6,71 +5,220 @@ [TIP] ==== -除 Docker Hub 外,IvorySQL 社区还为国内用户提供 Harbor 镜像服务。将本章节中的镜像地址前缀替换为 `registry.highgo.com/` 即可使用,例如 `registry.highgo.com/ivorysql/ivorysql:5.0-ubi8`。 +除 Docker Hub 外,IvorySQL 社区还为国内用户提供 Harbor 镜像服务。将本章节中的镜像地址前缀替换为 `registry.highgo.com/` 即可使用,例如 `registry.highgo.com/ivorysql/ivorysql:5.6-ubi8`。 ==== -== docker方式运行 - -** 从Docker Hub上获取IvorySQL镜像 -``` -$ docker pull ivorysql/ivorysql:5.0-ubi8 -``` - -** 运行IvorySQL -``` -$ docker run --name ivorysql -p 5434:5432 -e IVORYSQL_PASSWORD=your_password -d ivorysql/ivorysql:5.0-ubi8 -``` - -** 查看IvorySQL容器运行是否成功 -``` -$ docker ps | grep ivorysql -CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES -6faa2d0ed705 ivorysql/ivorysql:5.0-ubi8 "docker-entrypoint.s…" 50 seconds ago Up 49 seconds 5866/tcp, 0.0.0.0:5434->5432/tcp ivorysql -``` - -== podman方式运行 - -** 从Docker Hub上获取IvorySQL镜像 -``` -[highgo@manager-node1 ~]$ podman pull ivorysql/ivorysql:5.0-ubi8 -✔ docker.io/ivorysql/ivorysql:5.0-ubi8 -Trying to pull docker.io/ivorysql/ivorysql:5.0-ubi8... -Getting image source signatures -Copying blob 5885448c5c88 done | -Copying blob 6c502b378234 done | -Copying blob 8b4f2b90d6b6 done | -Copying blob 9b000f2935f6 done | -Copying blob 806f782da874 done | -Copying blob e4c51845a9eb done | -Copying blob dcb1e9a04275 done | -Copying blob 285a279173f8 done | -Copying blob 1f6f247b9ae0 done | -Copying blob 3cc81bed8614 done | -Copying blob 863c87bf25eb done | -Copying blob 4f4fb700ef54 done | -Copying config 88e1bbeda8 done | -Writing manifest to image destination -88e1bbeda81c51d88e12cbd2b19730498f1343d1c64bb3dddc8ffcb08a1f965f -``` - -** 运行IvorySQL -``` -$ podman run --name ivorysql -p 5434:5432 -e IVORYSQL_PASSWORD=123456 -d ivorysql/ivorysql:5.0-ubi8 -``` - -** 查看IvorySQL容器运行是否成功 -``` -[highgo@manager-node1 ~]$ podman ps | grep ivorysql -CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES -368dee58d5ef docker.io/ivorysql/ivorysql:5.0-ubi8 postgres 20 seconds ago Up 20 seconds 0.0.0.0:5434->5432/tcp, 1521/tcp, 5866/tcp ivorysql - -[highgo@manager-node1 ~]$ podman exec -it ivorysql /bin/bash -[root@8cc631eb413d /]# -ivorysql=# select version(); - version ------------------------------------------------------------------------------------------------------------------------- - PostgreSQL 18.0 (IvorySQL 5.0) on x86_64-pc-linux-gnu, compiled by gcc (GCC) 8.5.0 20210514 (Red Hat 8.5.0-28), 64-bit +== 镜像与监听端口 + +官方镜像 `ivorysql/ivorysql` 以 `5.6-ubi8` 为主标签,另有 `5.6-bookworm`、`5.6-trixie` 等基于不同基础镜像的变体,功能一致。镜像默认声明三个端口: + +[cols="1,1,3"] +|=== +| 端口 | 用途 | 说明 + +| `5432/tcp` | PostgreSQL 兼容监听 | 从该端口连入的会话,`ivorysql.compatible_mode` 为 `pg` +| `1521/tcp` | Oracle 兼容监听 | 从该端口连入的会话,`ivorysql.compatible_mode` 为 `oracle` +| `5866/tcp` | 初始化临时端口 | 只在容器初始化阶段内部使用,**不是对外服务**,无需发布 +|=== + +数据目录由镜像环境变量 `PGDATA` 固定为 `/var/local/ivorysql/ivorysql-5/data`,并声明为匿名卷。生产环境建议改用命名卷,见下文「数据持久化」。 + +== docker 方式运行 + +=== 拉取镜像 + +[source,bash] +---- +$ docker pull ivorysql/ivorysql:5.6-ubi8 +---- + +=== 启动容器 + +`IVORYSQL_PASSWORD` 是**必需**变量,它决定初始化时创建的超级用户口令。缺省时容器会直接退出(退出码 `1`),并在日志里给出: + +[source,text] +---- +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. +---- + +下面这条命令同时做了四件事:指定口令、把数据目录挂到命名卷、发布两个监听端口、加上健康检查: + +[source,bash] +---- +$ 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 +---- + +这里把容器的 `1521` 原样发布到宿主机 `1521`,把容器的 `5432` 发布到宿主机 `5433`,避免与本机已有的 PostgreSQL 冲突。宿主机端口可以按需调整。 + +=== 启动日志 + +容器正常启动后,日志里会依次出现两个监听端口的记录: + +[source,text] +---- +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 +---- + +=== 端口映射 + +[source,bash] +---- +$ docker port ivorysql +1521/tcp -> 0.0.0.0:11521 +1521/tcp -> [::]:11521 +5432/tcp -> 0.0.0.0:15532 +5432/tcp -> [::]:15532 +---- + +(上面的输出取自把容器端口发布到 `11521`、`15532` 的一次实测;按上一节的命令,这里应显示 `1521` 与 `5433`。) + +=== 环境变量 + +[cols="1,1,3"] +|=== +| 变量 | 默认值 | 说明 + +| `IVORYSQL_PASSWORD` | 无(必需) | 超级用户口令,缺失时容器退出 +| `IVORYSQL_USER` | `ivorysql` | 初始化时创建的超级用户名 +| `IVORYSQL_DB` | 与 `IVORYSQL_USER` 相同 | 初始化时创建的数据库名 +| `POSTGRES_INITDB_ARGS` | 无 | 追加给 `initdb` 的参数,例如 `-m pg` 可改成 PostgreSQL 模式初始化 +| `POSTGRES_HOST_AUTH_METHOD` | 无 | 设为 `trust` 可免密,容器会打印风险警告,不建议在生产使用 +|=== + +首次初始化时,挂载到 `/docker-entrypoint-initdb.d/` 下的 `*.sql` 会被自动执行,可用于建库建表或装载种子数据。 + +=== 数据持久化 + +容器把数据写在 `PGDATA`(`/var/local/ivorysql/ivorysql-5/data`)里,不挂卷时容器删除即丢数据。改用命名卷后,重启与重建容器都不影响数据: + +[source,bash] +---- +$ 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` 查看: + +[source,bash] +---- +$ docker volume inspect ivorysql_data +"Mountpoint": "/var/lib/docker/volumes/ivorysql_data/_data", +"Driver": "local", +---- + +挂载成功后,`PGDATA` 目录内可见 `PG_VERSION`(内容为 `18`)、`ivorysql.conf`、`pg_hba.conf` 等文件。 + +=== 健康检查 + +镜像里**没有** `ss`、`netstat`、`ps`(执行 `ps` 会得到 `ps: command not found`),所以健康检查不要依赖 `ss -lntp` 或 `curl`,用镜像自带的 `pg_isready` 即可,两个端口都能探测: + +[source,text] +---- +/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 +---- + +== 一个容器,两个端口,两种兼容模式 + +这是 IvorySQL 镜像最容易踩坑的地方:**同一个容器、同一份数据,从 `1521` 连进去是 Oracle 兼容模式,从 `5432` 连进去是 PostgreSQL 模式**。 + +[source,bash] +---- +$ 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 "<同一条查询>" +1521|oracle|18.6 +---- + +对比 `pg_settings` 里的 `ivorysql.*` 参数,两侧八项中**只有 `ivorysql.compatible_mode` 不同**: + +[source,text] +---- +# 1521 监听 +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 监听 +ivorysql.compatible_mode=pg +(其余 7 项完全相同) +---- + +注意 `ivorysql.database_mode` 在两种连接下都是 `oracle`:它记录的是建库时选择的模式,不会因为换了连接端口而改变;改变的是当前会话按哪套语义解析 SQL。 + +因此在 Oracle 监听上可以直接建 Oracle 风格的表,建好后两个端口都能读: + +[source,sql] +---- +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) +---- + +容器默认按 Oracle 模式初始化,这是 `initdb` 自身的默认值(`-m, --dbmode=MODE set database mode, default is oracle`);启动脚本没有另外传参,所以想改成 PostgreSQL 模式初始化,需要用 `-e POSTGRES_INITDB_ARGS="-m pg"`。 + +== podman 方式运行 + +Podman 的命令行与 Docker 基本一致,把上文的 `docker` 换成 `podman` 即可: + +[source,bash] +---- +$ 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 +---- + +容器起来后用 `podman exec` 进入容器,或在宿主机上直接用 `psql` 连两个端口,验证方式与 Docker 完全相同: + +[source,bash] +---- +$ 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 兼容 +$ psql -h 127.0.0.1 -p 5433 -U ivorysql -d postgres # PostgreSQL 兼容 +---- + +== 常见问题 -ivorysql=# -``` \ No newline at end of file +* **容器起来就退出**:`docker logs ivorysql` 里出现 `Database is uninitialized and superuser password is not specified.`,说明漏了 `-e IVORYSQL_PASSWORD`。 +* **`1521` 连不上**:`docker ps` 的 `PORTS` 列里只有 `5432/tcp`,说明启动时没发布 `1521`,补上 `-p 1521:1521`。 +* **宿主机 `1521` 已被占用**:改发布端口即可,例如 `-p 11521:1521`,容器内仍是 `1521`。 +* **看到 `5866/tcp` 却连不上**:它是初始化阶段的临时端口,只在容器初始化时于本机使用,不对外提供服务。 diff --git a/EN/modules/ROOT/pages/master/containerization/docker_podman_deployment.adoc b/EN/modules/ROOT/pages/master/containerization/docker_podman_deployment.adoc index abb1318a..fdf2065d 100644 --- a/EN/modules/ROOT/pages/master/containerization/docker_podman_deployment.adoc +++ b/EN/modules/ROOT/pages/master/containerization/docker_podman_deployment.adoc @@ -1,76 +1,224 @@ - :sectnums: :sectnumlevels: 5 -= Docker & Podman deployment IvorySQL += Deploying IvorySQL with Docker and Podman [TIP] ==== -In addition to Docker Hub, the IvorySQL community also provides a Harbor registry for users in China. Replace the image prefix used in this chapter with `registry.highgo.com/`, e.g. `registry.highgo.com/ivorysql/ivorysql:5.0-ubi8`. +Besides Docker Hub, the IvorySQL community provides a Harbor registry for users in China. Replace the registry prefix in this chapter with `registry.highgo.com/`, for example `registry.highgo.com/ivorysql/ivorysql:5.6-ubi8`. ==== -== Running IvorySQL in docker +== Image and listening ports -** Get IvorySQL image from Docker Hub -``` -$ docker pull ivorysql/ivorysql:5.0-ubi8 -``` +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: -** Running IvorySQL -``` -$ docker run --name ivorysql -p 5434:5432 -e IVORYSQL_PASSWORD=your_password -d ivorysql/ivorysql:5.0-ubi8 -``` +[cols="1,1,3"] +|=== +| Port | Purpose | Notes -** Check if the IvorySQL container is running successfully -``` -$ docker ps | grep ivorysql -CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES -6faa2d0ed705 ivorysql/ivorysql:5.0-ubi8 "docker-entrypoint.s…" 50 seconds ago Up 49 seconds 5866/tcp, 0.0.0.0:5434->5432/tcp ivorysql -``` +| `5432/tcp` | PostgreSQL-compatible listener | Sessions connected on this port see `ivorysql.compatible_mode = pg` +| `1521/tcp` | Oracle-compatible listener | Sessions connected on this port see `ivorysql.compatible_mode = oracle` +| `5866/tcp` | Temporary init port | Used only inside the container while it initializes; **not a service port**, no need to publish it +|=== -== Running with Podman +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. + +== Running with Docker + +=== Pull the image + +[source,bash] +---- +$ docker pull ivorysql/ivorysql:5.6-ubi8 +---- + +=== 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: + +[source,text] +---- +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: + +[source,bash] +---- +$ 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. + +=== Startup log + +A healthy container logs both listeners: + +[source,text] +---- +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 +---- + +=== Port mapping + +[source,bash] +---- +$ 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.) + +=== Environment variables + +[cols="1,1,3"] +|=== +| Variable | Default | Notes + +| `IVORYSQL_PASSWORD` | none (required) | Superuser password; the container exits when it is missing +| `IVORYSQL_USER` | `ivorysql` | Superuser name created during initialization +| `IVORYSQL_DB` | same as `IVORYSQL_USER` | Database name created during initialization +| `POSTGRES_INITDB_ARGS` | none | Extra arguments passed to `initdb`, for example `-m pg` initializes in PostgreSQL mode +| `POSTGRES_HOST_AUTH_METHOD` | none | Set to `trust` to disable password checks; the container prints a warning, not recommended in production +|=== + +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. + +=== 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: + +[source,bash] +---- +$ 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: + +[source,bash] +---- +$ 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. + +=== 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: + +[source,text] +---- +/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 +---- + +== 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`.** + +[source,bash] +---- +$ 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 "" +1521|oracle|18.6 +---- + +Comparing the `ivorysql.*` parameters in `pg_settings`, **only `ivorysql.compatible_mode` differs** among the eight entries: + +[source,text] +---- +# 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 -** Pull IvorySQL Image from Docker Hub -``` -[highgo@manager-node1 ~]$ podman pull ivorysql/ivorysql:5.0-ubi8 -✔ docker.io/ivorysql/ivorysql:5.0-ubi8 -Trying to pull docker.io/ivorysql/ivorysql:5.0-ubi8... -Getting image source signatures -Copying blob 5885448c5c88 done | -Copying blob 6c502b378234 done | -Copying blob 8b4f2b90d6b6 done | -Copying blob 9b000f2935f6 done | -Copying blob 806f782da874 done | -Copying blob e4c51845a9eb done | -Copying blob dcb1e9a04275 done | -Copying blob 285a279173f8 done | -Copying blob 1f6f247b9ae0 done | -Copying blob 3cc81bed8614 done | -Copying blob 863c87bf25eb done | -Copying blob 4f4fb700ef54 done | -Copying config 88e1bbeda8 done | -Writing manifest to image destination -88e1bbeda81c51d88e12cbd2b19730498f1343d1c64bb3dddc8ffcb08a1f965f -``` - -** Run IvorySQL Container -``` -$ podman run --name ivorysql -p 5434:5432 -e IVORYSQL_PASSWORD=123456 -d ivorysql/ivorysql:5.0-ubi8 -``` - -** Check if IvorySQL Container is Running Successfully -``` -[highgo@manager-node1 ~]$ podman ps | grep ivorysql -CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES -368dee58d5ef docker.io/ivorysql/ivorysql:5.0-ubi8 postgres 20 seconds ago Up 20 seconds 0.0.0.0:5434->5432/tcp, 1521/tcp, 5866/tcp ivorysql - -[highgo@manager-node1 ~]$ podman exec -it ivorysql /bin/bash -[root@8cc631eb413d /]# -ivorysql=# select version(); - version ------------------------------------------------------------------------------------------------------------------------- - PostgreSQL 18.0 (IvorySQL 5.0) on x86_64-pc-linux-gnu, compiled by gcc (GCC) 8.5.0 20210514 (Red Hat 8.5.0-28), 64-bit +# 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: + +[source,sql] +---- +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"`. + +== Running with Podman + +The Podman command line matches Docker, so replace `docker` with `podman`: + +[source,bash] +---- +$ 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: + +[source,bash] +---- +$ 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 +---- + +== Troubleshooting -ivorysql=# -``` \ No newline at end of file +* **The container exits right after starting**: `docker logs ivorysql` shows `Database is uninitialized and superuser password is not specified.`, meaning `-e IVORYSQL_PASSWORD` was omitted. +* **Nothing answers on `1521`**: the `PORTS` column of `docker ps` lists only `5432/tcp`, so `1521` was never published; add `-p 1521:1521`. +* **Host port `1521` is already taken**: publish another host port, for example `-p 11521:1521`; the container still listens on `1521`. +* **`5866/tcp` is listed but refuses connections**: it is the temporary init port, used only inside the container during initialization and never published.