-
Notifications
You must be signed in to change notification settings - Fork 2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: docker-entrypoint.sh file handling, closes #1456 #1579
Conversation
The docker-entrypoint.sh script added in nodejs#1039 is intended to run the supplied command with "node" if it contains a "-" or doesn't correspond to a system command. In Alpine, this doesn't work if the supplied command corresponds to a regular, non-executable JS file. The root issue is a bug in ash/dash: its implementation of "command -v" incorrectly outputs the supplied command_name even for non-executable files. This is a violation of the POSIX standard and has been reported to the Debian team in https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=874264, though there's been no activity in several years. As a workaround, this adds an additional check to docker-entrypoint.sh for regular files that aren't marked as executable.
e29935e
to
3101ce6
Compare
We have a couple of smoke tests (just running |
@SimenB Okay, I added a simple regression test to |
.github/workflows/build-test.yml
Outdated
@@ -82,6 +82,14 @@ jobs: | |||
echo "Expected: \"${{ matrix.version }}\", Got: \"${image_node_version}\"" | |||
[ "${image_node_version}" == "${{ matrix.version }}" ] | |||
|
|||
- name: Regression test for issue 1456 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure if it's a good naming, maybe something more meaningful will be great.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay, I renamed it to "Verify entrypoint runs regular, non-executable files with node" and slightly simplified it
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice, thanks @MasonM
9cc6cfb
to
f89451f
Compare
@SimenB I did some research to see if there was a better way of writing tests, and I found #802, which added BATS to this repo. With BATS, the test I added to
That's cleaner IMO and would make it easy to add additional test cases, but BATS was removed in #1339. I think it should be brought back, though it probably should be in a separate PR to keep this one focused. What do you think? |
Should be fine to re-add? /cc @nodejs/docker |
I'm good to add it back 👍 |
Getting the test in would be great also beyond this specific issue, as it would have caught #1582 as well (at least I think so) |
Okay, I'll work on adding back BATS and integrating it with Github Actions after this is merged. edit: Here's a draft: #1588 |
Thanks @MasonM! |
Created PR on the official-images repo (docker-library/official-images#11157). See https://github.com/docker-library/faq#an-images-source-changed-in-git-now-what if you are wondering when it will be available on the Docker Hub. |
Description
The
docker-entrypoint.sh
script added in #1043 is intended to run the supplied command withnode
if it contains a-
or doesn't correspond to a system command. In Alpine, this doesn't work if the supplied command corresponds to a regular, non-executable JS file.The root issue is a bug in ash/dash: its implementation of
command -v <command_name>
incorrectly outputs the suppliedcommand_name
even for non-executable files. This is a violation of the POSIX standard and has been reported to the Debian team, though there's been no activity in several years.As a workaround, this adds an additional check to docker-entrypoint.sh for regular files that aren't marked as executable.
Motivation and Context
See #1456
Testing Details
Example Output(if appropriate)
N/A
Types of changes
Checklist