postgres icon indicating copy to clipboard operation
postgres copied to clipboard

No such file or directory error

Open RedstoneWizard08 opened this issue 3 years ago • 0 comments

Bug report

Describe the bug

When I try to run this image (when self-hosting SupaBase), it gives me this error:

standard_init_linux.go:228: exec user process caused: no such file or directory

To Reproduce

Steps to reproduce the behavior, please provide code snippets or a repository:

  1. Open your terminal.
  2. Make sure you have Docker installed.
  3. Run this command:
docker run -it --rm supabase/postgres:14.1.0
  1. See error

Expected behavior

It runs as it should with all the extensions and everything.

Screenshots

image

System information

  • OS: linux/arm64/v8 (Ubuntu 21.10 Impish Indri, headless)
  • Browser: N/A
  • Version of supabase-js: N/A
  • Version of Node.js: 17.6.0
  • Version of Docker: 20.10.13 build a224086

Additional context

This also happens with the latest tag of the image, the 14.1.0-ci-test tag, the 13.3.0 tag, and the 14.1.0 tag as seen above. I have been able to use a custom Dockerfile to get this working, but I don't think it is completely correct and I would like to be able to use the pre-built images for the sake of convenience. I have included the Dockerfile below.

Dockerfile (Expand)
# Base OS
FROM ubuntu:focal

# Environment variables
ENV TZ=US/Pacific \
    LC_ALL=en_US.utf8 \
    DEBIAN_FRONTEND=noninteractive \
    LANG=en_US.utf8 \
    LANGUAGE=en_US.utf8 \
    PGDATA=/var/lib/postgresql/data \
    PATH="$PATH:/usr/lib/postgresql/14/bin"

# Install dependencies and PostgreSQL Repository
RUN apt-get update && \
    apt-get -y upgrade && \
    apt-get -y install ansible software-properties-common \
    ca-certificates apt-transport-https coreutils wget \
    curl gnupg gpg apt-utils tzdata bash default-jdk-headless && \
    echo "deb http://apt.postgresql.org/pub/repos/apt $(lsb_release -cs)-pgdg main" \
    | tee /etc/apt/sources.list.d/pgdg.list && \
    wget -qO- https://www.postgresql.org/media/keys/ACCC4CF8.asc | apt-key add - && \
    apt-get update && \
    apt-get -y upgrade && \
    apt-get -y install build-essential \
    gcc g++ gpp cpp git-core postgresql-server-dev-14 \
    pkg-config rsync sudo python python3 cmake clang \
    ninja-build git libgeos-dev libproj-dev libgdal-dev \
    libjson-c-dev libxml2-dev libboost-all-dev libcgal-dev \
    libmpfr-dev libgmp-dev libc++-dev libc++abi-dev libc++1 \
    libglib2.0-dev libtinfo5 libc++abi1 && \
    wget "https://gitlab.com/Oslandia/SFCGAL/-/archive/v1.3.10/SFCGAL-v1.3.10.tar.gz" -O \
    /tmp/SFCGAL-v1.3.10.tar.gz && tar -zxvf /tmp/SFCGAL-v1.3.10.tar.gz -C /tmp && \
    git clone https://github.com/plv8/plv8.git /tmp/plv8 && \
    cd /tmp/plv8 && git checkout 3656177d384e3e02b74faa8e2931600f3690ab59 && \
    ln -sf /lib/aarch64-linux-gnu/libc++.so.1 /lib/aarch64-linux-gnu/libc++.so

# Copy ansible playbook
COPY ./ansible /ansible
WORKDIR /ansible

# Set shell to Bash instead of the default POSIX shell (dash)
SHELL [ "/bin/bash", "-c" ]

# Build SFCGAL
RUN cd /tmp/SFCGAL-v1.3.10 && \
    cmake . && \
    make

# Build PLV8
RUN cd /tmp/plv8 && \
    make

# Run the playbook and clean up
RUN ansible-playbook playbook-docker.yml && \
    apt-get update && apt-get -y upgrade && apt-get -y autoremove && apt-get clean && \
    apt-get -y autoclean && rm -rf /tmp/* /var/lib/apt/lists/* /var/tmp/*
WORKDIR /

# Install PostgreSQL
RUN apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 7FCC7D46ACCC4CF8 && \
    apt-get update && \
    apt-get -y upgrade && \
    mkdir -p /var/lib/postgresql && \
    chown -R postgres:postgres /var/lib/postgresql && \
    apt-get -y install postgresql-14 && \
    localedef -i en_US -c -f UTF-8 -A /usr/share/locale/locale.alias en_US.UTF-8 && \
    apt-get update && apt-get -y upgrade && apt-get -y autoremove && apt-get clean && \
    apt-get -y autoclean && rm -rf /tmp/* /var/lib/apt/lists/* /var/tmp/* && \
    sed -i "s/pgsodium.getkey_script= '\/usr\/lib\/postgresql\/bin\/pgsodium_getkey_urandom.sh'/pgsodium.getkey_script= '\/usr\/lib\/postgresql\/14\/bin\/pgsodium_getkey_urandom.sh'/g" /etc/postgresql/postgresql.conf && \
    chmod -R a+rx /usr/lib/postgresql/14/bin && \
    mkdir -p /var/run/postgresql && chown -R postgres:postgres /var/run/postgresql && \
    chmod 2777 /var/run/postgresql

# Volumes and ports
VOLUME /var/lib/postgresql/data
EXPOSE 5432
STOPSIGNAL SIGINT

# Add entrypoint
COPY docker/psql-docker-entrypoint.sh /usr/local/bin/docker-entrypoint.sh
RUN chmod a+rx /usr/local/bin/docker-entrypoint.sh

# Use the postgres user
USER postgres

# Initialize the database
RUN /usr/lib/postgresql/14/bin/initdb /var/lib/postgresql/data

# Complete the image
ENTRYPOINT [ "/bin/bash", "/usr/local/bin/docker-entrypoint.sh" ]
CMD ["postgres", "-c", "config_file=/etc/postgresql/postgresql.conf"]

RedstoneWizard08 avatar Mar 18 '22 23:03 RedstoneWizard08