omni_containers

Omnigres Docker容器管理模块

概览

扩展包名版本分类许可证语言
omnigres0.2.0FEATApache-2.0C
ID扩展名BinLibLoadCreateTrustReloc模式
2940omniomni
2941omni_authomni_auth
2942omni_awsomni_aws
2943omni_cloudeventsomni_cloudevents
2944omni_containersomni_containers
2945omni_credentialsomni_credentials
2948omni_emailomni_email
2949omni_httpomni_http
2950omni_httpcomni_httpc
2951omni_httpdomni_httpd
2952omni_id-
2953omni_jsonomni_json
2954omni_kubeomni_kube
2955omni_ledgeromni_ledger
2956omni_manifestomni_manifest
2957omni_mimetypesomni_mimetypes
2958omni_osomni_os
2959omni_polyfillomni_polyfill
2960omni_pythonomni_python
2961omni_regex-
2962omni_restomni_rest
2963omni_schemaomni_schema
2964omni_seqomni_seq
2965omni_serviceomni_service
2966omni_sessionomni_session
2968omni_sqlomni_sql
2969omni_sqliteomni_sqlite
2970omni_testomni_test
2971omni_txnomni_txn
2972omni_typesomni_types
2973omni_varomni_var
2974omni_vfsomni_vfs
2975omni_vfs_types_v1omni_vfs_types_v1
2976omni_webomni_web
2977omni_workeromni_worker
2978omni_xmlomni_xml
2979omni_yamlomni_yaml
相关扩展omni_httpc omni_web

版本

类型仓库版本PG 大版本包名依赖
EXTPIGSTY0.2.01817161514omnigresomni_httpc, omni_web
RPMPIGSTY0.2.01817161514omnigres_$v-
DEBPIGSTY0.2.01817161514postgresql-$v-omnigres-
OS / PGPG18PG17PG16PG15PG14
el8.x86_64PIGSTY MISSPIGSTY 20250120PIGSTY 20250120PIGSTY 20250120PIGSTY 20250120
el8.aarch64PIGSTY MISSPIGSTY 20250120PIGSTY 20250120PIGSTY 20250120PIGSTY 20250120
el9.x86_64PIGSTY MISSPIGSTY 20250507PIGSTY 20250507PIGSTY 20250507PIGSTY 20250507
el9.aarch64PIGSTY MISSPIGSTY 20250507PIGSTY 20250507PIGSTY 20250507PIGSTY 20250507
el10.x86_64PIGSTY MISSPIGSTY MISSPIGSTY MISSPIGSTY MISSPIGSTY MISS
el10.aarch64PIGSTY MISSPIGSTY MISSPIGSTY MISSPIGSTY MISSPIGSTY MISS
d12.x86_64PIGSTY MISSPIGSTY 20250120PIGSTY 20250120PIGSTY 20250120PIGSTY 20250120
d12.aarch64PIGSTY MISSPIGSTY 20250120PIGSTY 20250120PIGSTY 20250120PIGSTY 20250120
d13.x86_64PIGSTY 20251108PIGSTY 20251108PIGSTY 20251108PIGSTY 20251108PIGSTY 20251108
d13.aarch64PIGSTY 20251108PIGSTY 20251108PIGSTY 20251108PIGSTY 20251108PIGSTY 20251108
u22.x86_64PIGSTY MISSPIGSTY 20250120PIGSTY 20250120PIGSTY 20250120PIGSTY 20250120
u22.aarch64PIGSTY MISSPIGSTY 20250120PIGSTY 20250120PIGSTY 20250120PIGSTY 20250120
u24.x86_64PIGSTY 20251108PIGSTY 20251108PIGSTY 20251108PIGSTY 20251108PIGSTY 20251108
u24.aarch64PIGSTY 20251108PIGSTY 20251108PIGSTY 20251108PIGSTY 20251108PIGSTY 20251108

构建

您可以使用 pig build 命令构建 omnigres 扩展的 RPM / DEB 包:

pig build pkg omnigres         # 构建 RPM / DEB 包

安装

您可以直接安装 omnigres 扩展包的预置二进制包,首先确保 PGDGPIGSTY 仓库已经添加并启用:

pig repo add pgsql -u          # 添加仓库并更新缓存

使用 pig 或者是 apt/yum/dnf 安装扩展:

pig install omnigres;          # 当前活跃 PG 版本安装
pig ext install -y omnigres -v 18  # PG 18
pig ext install -y omnigres -v 17  # PG 17
pig ext install -y omnigres -v 16  # PG 16
pig ext install -y omnigres -v 15  # PG 15
pig ext install -y omnigres -v 14  # PG 14
dnf install -y omnigres_18       # PG 18
dnf install -y omnigres_17       # PG 17
dnf install -y omnigres_16       # PG 16
dnf install -y omnigres_15       # PG 15
dnf install -y omnigres_14       # PG 14
apt install -y postgresql-18-omnigres   # PG 18
apt install -y postgresql-17-omnigres   # PG 17
apt install -y postgresql-16-omnigres   # PG 16
apt install -y postgresql-15-omnigres   # PG 15
apt install -y postgresql-14-omnigres   # PG 14

创建扩展

CREATE EXTENSION omni_containers CASCADE;  -- 依赖: omni_httpc, omni_web

用法

omni_containers: Docker 容器管理

omni_containers 扩展从 PostgreSQL 管理 Docker 容器生命周期。需要 Docker Engine API 访问权限(默认 unix:///var/run/docker.sock)。

创建并启动容器

SELECT * FROM omni_containers.docker_container_create(
    'busybox',
    cmd  => 'echo Hello world',
    pull => true
);

参数:image(必需)、cmdattach(默认 db.omni)、start(默认 true)、wait(默认 false)、pull(默认 false)、options(jsonb)。

容器日志

SELECT * FROM omni_containers.docker_container_logs('container_id');

支持 stdoutstderrsinceuntiltimestampstail 参数。

在容器中执行命令

SELECT * FROM omni_containers.docker_container_exec('container_id', 'ls -la');

停止和检查

SELECT * FROM omni_containers.docker_container_stop('container_id');
SELECT info->'State'->'ExitCode' FROM omni_containers.docker_container_inspect('container_id') AS info;

列出 Docker 镜像

SELECT repo_tags FROM omni_containers.docker_images;

完整工作流示例

WITH container AS (
    SELECT * FROM omni_containers.docker_container_create(
        'ghcr.io/yrashk/psql',
        cmd  => $$psql -c 'create table test ();'$$,
        wait => true, pull => true) AS id
)
SELECT
    omni_containers.docker_container_inspect(id)->'State'->'ExitCode' AS exit_code,
    omni_containers.docker_container_logs(id) AS logs
FROM container;

最后修改 2026-03-14: update extension metadata (953cbd0)