Fixed bug in node:16-alpine Dockerfile that appears on arm64 architecture #1716
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Bug:
I was unable to use yarn on arm64 architecture
Description
I normally used
node:16-alpine
in my docker file. It works fine on amd64 architecture. Then I was needed to build an arm64 image of the container. And there happened a problem.Simplified Dockerfile for this example:
Output of
docker buildx inspect
:Command I use to build container for both architectures:
Previous command causes this output:
From this output, we can see that the problem appears only on arm64 arch.
I started to research this problem and found that everything was fine except for, well, there is no either
/usr/local/sbin
, neither/usr/local/sbin/node
I checked both arm64 and amd64 images of
node:16-alpine
and both of them doesn't have/usr/local/sbin
directory. I don't know why but it becomes a problem only for arm64 build.I changed my Dockerfile to
Output was like that:
I want to pay attention to
which node
because it shows that node.js is placed in/usr/local/bin/node
mkdir /usr/local/sbin
will throw an error when alpine team will create this directory, but the error will be ignored because of;
.Then I added a link to node js and then everything started work fine
Testing Details
I tried to build this Dockerfile
And build was successfull on both architectures
So I decided to add this little fix right into the original
node:16-alpine
imageTypes of changes
Checklist