在 Alpine Docker 容器中收到 [Not Found] 错误,尽管它确实存在

Receive [Not Found] error in Alpine Docker Container although it certainly exists

当 运行 alpine docker 容器并尝试构建时,我收到这样的错误消息。

/bin/sh: /etc/init.d/postgresql: not found

这是我的 Dockerfile:

FROM alpine:3.5

MAINTAINER hoge

ENV LANG en_US.utf8

ENV PHX_PORT 4000
ENV PHX_DBNAME hoge_db

COPY release.tar.gz /

RUN echo 'http://dl-3.alpinelinux.org/alpine/edge/testing' >> /etc/apk/repositories

RUN apk update && apk upgrade && \
    apk add --no-cache --virtual .base_deps build-base openssl-dev zlib-dev libxml2-dev wget gnupg ca-certificates && \
    apk add --no-cache readline-dev glib-lang libssl1.0 postgresql postgresql-client && \
    apk add --update binutils && \
    apk add --no-cache sudo && \
    apk --purge del .base_deps && \
    tar -xzf ./release.tar.gz && \
    echo "postgres ALL=(ALL) NOPASSWD: ALL" > /etc/sudoers.d/postgres && \
    chmod 600 /etc/sudoers.d/postgres && \
    sync && \
    /etc/init.d/postgresql setup && \
    /etc/init.d/postgresql start && \
    readelf -l /etc/init.d/postgresql | grep "program interpreter" && \
    psql -U postgres -c "CREATE DATABASE $PHX_DBNAME WITH ENCODING 'UTF8' OWNER=postgres TEMPLATE = template0;"


VOLUME /var/lib/postgresql/data

ENTRYPOINT ["psql", "-U", "postgres"]

EXPOSE 5432

/etc/init.d/postgresql肯定存在
我确实通过实际进入容器确认了它的存在。
我该如何修改?

您需要将 openrc 添加到 apk add 命令列表中。

在检查 /etc/init.d/postgresql 文件并查看 shebang 行引用 openrc

后,在 github issue 上找到了相同的解决方案