Some Dockerfile-based services can run commands as USER 0, others fail during build
benisenstein
PROOP

10 months ago

Hello Railway community and love all your work!

Project ID: cd22524a-2d8b-4ec7-8ea5-bedb4df89632

Service ID: 6f93a298-1a5b-40d8-b4ef-241d97187617

Environment ID: 4f9133fe-f189-4160-944b-45ad5d2f039d

Several services in my project are built from a Dockerfile that essentially just installs a couple packages on top of a popular Docker image.

The following Dockerfile service, built on top of "kong:2.8.1" builds and deploys without errors from the following Dockerfile code:

FROM kong:2.8.1
COPY ./kong.yml /home/kong/temp.yml
USER 0
RUN apk update && apk add gettext
USER kong
ENTRYPOINT envsubst < /home/kong/temp.yml > /home/kong/kong.yml && /docker-entrypoint.sh kong docker-start

However another service, whose ID I pasted above, fails when trying to build. It is built on "postgrest/postgrest:v12.2.12" and tries to install curl. This works on my machine, and I've checked that a root user 0 does indeed exist on the image. Here is the Dockerfile code:

FROM postgrest/postgrest:v12.2.12

USER 0
RUN apt-get update && apt-get install -y curl 
USER 1000

Some explanation for why this might be failing would be much appreciated! Thank you

$10 Bounty

3 Replies

10 months ago

Quantum


vedmaka
HOBBY

10 months ago

fails when trying to build

Could you share the error log please? The Dockerfile itself looks good and should not fail


cbarr32

Quantum

idiegea21
HOBBY

10 months ago

Try keeping USER root during the build, or use a multi-stage Dockerfile to install curl in a Debian stage and copy it into the PostgREST image.


Welcome!

Sign in to your Railway account to join the conversation.

Loading...