From 724c562d6f876e6cd2b3ac1cba7902748d472eca Mon Sep 17 00:00:00 2001 From: Eric Eastwood Date: Wed, 15 Jun 2022 18:42:15 -0500 Subject: [PATCH] Fix image not running in K8s (ROSA) (#24) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fix image not running in K8s (ROSA) Trying to solve the container exiting with error code `243`. `npm` throws `243` for any command you try to run with it. Here is how to get into the container while the entrypoint normally errors. ``` $ oc run -i --tty --image=ghcr.io/matrix-org/matrix-public-archive/matrix-public-archive:sha-65edaea1a9713bb2cc93fa98638327fdeff765cd mpa-test2 --port=3050 --restart=Never --env="DOMAIN=cluster" --command /bin/bash $ npm start $ echo $? 243 ``` Why does the same image work in Docker? ``` $ docker run -it --entrypoint /bin/bash ghcr.io/matrix-org/matrix-public-archive/matrix-public-archive:sha-65edaea1a9713bb2cc93fa98638327fdeff765cd $ npm start # it starts ✅ ``` ## Root cause Seems like it could be either of these issues. Both are `8.6.0`+ problems as well which lines up with the `npm` version available in each base image. - https://github.com/npm/cli/issues/4769 - https://github.com/npm/cli/issues/4996 - Specific comment about breaking stuff in k8s for other people, https://github.com/npm/cli/issues/4996#issuecomment-1150290804 --- Dockerfile | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/Dockerfile b/Dockerfile index ae3c9b5..ff07637 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,11 +1,13 @@ -FROM node:16.15-buster-slim +# XXX: Before updating this, make sure the issues around `npm` silently exiting +# with error 243 issues are solved: +# - https://github.com/npm/cli/issues/4996 +# - https://github.com/npm/cli/issues/4769 +FROM node:16.14.2-buster-slim RUN mkdir -p /app WORKDIR /app -RUN npm install npm@^8 --location=global - # Copy the health-check script COPY docker-health-check.js /app/