nodejs / docker-node

Official Docker Image for Node.js :whale: :turtle: :rocket:
https://hub.docker.com/_/node/
MIT License
8.13k stars 1.95k forks source link

node:20.11.0 The RUN command not work while running the Dockerfile. #2019

Closed finda-yeongjo closed 4 months ago

finda-yeongjo commented 5 months ago

Environment

Expected Behavior

Build Success

Current Behavior

[4/5] RUN ln -sf /usr/share/zoneinfo/Asia/Seoul /etc/localtime: ERROR: failed to solve: process "/bin/sh -c ln -sf /usr/share/zoneinfo/Asia/Seoul /etc/localtime" did not complete successfully: exit code: 1

Possible Solution

-

Steps to Reproduce

FROM node:20.11.0-slim

ARG APP_ENV
ENV APP_ENV=$APP_ENV

WORKDIR /usr/src

COPY . .

RUN ln -sf /usr/share/zoneinfo/Asia/Seoul /etc/localtime
ENV TZ="Asia/Seoul"
ENV LANG="en_US.UTF-8"

ENTRYPOINT yarn start:${APP_ENV}

run: docker buildx build --platform linux/amd64

Additional Information

We were using only base imagea node:16.17.0-alpine in the same Dockerfile format. However, when upgrading the nodejs version and changing the base image to node:20.11.0-slim, the above issue occurs. (same for node:20.11.0, node:20.11.0-alpine)

The ln -sf command itself has nothing to do with whether the file exists or not, and it seems to be an error in the Dockerfile RUN command, but the same error occurs even if different RUN command formats are used. (RUN bash -c 'ln -sf /usr/share/zoneinfo/Asia/Seoul /etc/localtime') (RUN ["/bin/ln", "-sf", "/usr/share/zoneinfo/Asia/Seoul", "/etc/localtime"])

LaurentGoderre commented 5 months ago

I can't reproduce locally

finda-yeongjo commented 5 months ago

Oh, maybe this is the information you need.

My github runner server is Amazon Linux 2023 ami-0d1b1d27dab2f860a

Maybe you can reproduce it if you test that server.

LaurentGoderre commented 4 months ago

This might be related to your issues: https://github.com/docker/buildx/issues/1986

finda-yeongjo commented 4 months ago

This issue has been resolved.

First, I checked and applied the notice in github action. (Ref. https://github.blog/changelog/2023-09-22-github-actions-transitioning-from-node-16-to-node-20/) Second, I added the platform to be used in buildx. (ex. docker buildx create --name multiarch --platform linux/amd64,linux/arm64 --driver docker-container)

Afterwards, the above issue does not occur and it operates successfully.