Skip to content

Could not open extension control file "/usr/share/postgresql/17/extension/wal2json.control": No such file or directory. #291

@omtodkar

Description

@omtodkar

I am trying to build a custom postgres 17 image with wal2json installed in it.

FROM postgres:17

ENV PATH="/usr/lib/postgresql/17/bin:$PATH"

RUN apt-get update && \
        apt-get install -y \
        postgresql-contrib \
        postgresql-17-wal2json \
        build-essential \
        postgresql-server-dev-17

RUN apt-get remove -y build-essential postgresql-server-dev-17 wget && \
    apt-get autoremove -y && \
    rm -rf /var/lib/apt/lists/*

COPY postgresql.conf /etc/postgresql/postgresql.conf

CMD ["postgres", "-c", "config_file=/etc/postgresql/postgresql.conf"]

My 0-initial.sql script to run on launch.

-- Other stuff

CREATE EXTENSION IF NOT EXISTS wal2json;

But when I try to run this image I get error:

psql:/docker-entrypoint-initdb.d/0-initial.sql:14: ERROR:  extension "wal2json" is not available
2025-08-03T09:42:18.033729097Z DETAIL:  Could not open extension control file "/usr/share/postgresql/17/extension/wal2json.control": No such file or directory.
2025-08-03T09:42:18.033730972Z HINT:  The extension must first be installed on the system where PostgreSQL is running.
2025-08-03T09:42:18.033732972Z CREATE EXTENSION
2025-08-03T09:42:18.033743222Z 2025-08-03 09:42:18.033 UTC [61] LOG:  statement: CREATE EXTENSION IF NOT EXISTS wal2json;
2025-08-03T09:42:18.033744722Z 2025-08-03 09:42:18.033 UTC [61] ERROR:  extension "wal2json" is not available
2025-08-03T09:42:18.033745972Z 2025-08-03 09:42:18.033 UTC [61] DETAIL:  Could not open extension control file "/usr/share/postgresql/17/extension/wal2json.control": No such file or directory.
2025-08-03T09:42:18.033747180Z 2025-08-03 09:42:18.033 UTC [61] HINT:  The extension must first be installed on the system where PostgreSQL is running.
2025-08-03T09:42:18.033748305Z 2025-08-03 09:42:18.033 UTC [61] STATEMENT:  CREATE EXTENSION IF NOT EXISTS wal2json;

I tried downloading tar.gz and installing too

RUN wget -O /tmp/wal2json_2_6.tar.gz https://github.com/eulerto/wal2json/archive/refs/tags/wal2json_2_6.tar.gz && \
    tar -xzf /tmp/wal2json_2_6.tar.gz -C /tmp && \
    cd /tmp/wal2json-wal2json_2_6 && \
    make && make install && \
    rm -rf /tmp/wal2json*

Can someone help me with the correct way to install this extension?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions