-
Notifications
You must be signed in to change notification settings - Fork 27
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
Docker container fails when running with host user (-u
)
#175
Labels
enhancement
New feature or request
Comments
Thank you, Julian for figuring out the details. We switched to using ${SHELL} to support Mac that doesn't have bash installed, but overlooked the issue when running docker with |
great, thanks! |
julibeg
changed the title
Docker container fails when running with host user
Docker container fails when running with host user (Feb 25, 2023
-u
)
fixed in v1.0.0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I'll try to explain the problem to the best of my ability:
Per default, the user in a Docker container is
root
. This entails that any files created in mounted directories by commands run in the container are owned byroot
and can only be read by other users, not written to. To get around this, many people are adding-u $(id -u)
to theirdocker run
command.However, this user does not exist in the container and thus does not have a default shell. The container will therefore fall back to using
/bin/sh
. Crucially, the env variableSHELL
is set at this stage and, as you might be aware, shells don't setSHELL
themselves (SHELL
is set on login; i.e. if you startbash
from another shell it won't setSHELL
to/bin/bash
; it will just inherit theSHELL
env variable from the previous shell; you can test this by runningSHELL=bla bash -c 'echo $SHELL'
). Taken together, this means that, when the user runsthey will get the following error:
This is because the following happens:
sh
since there is no default shell for the user$(id -u)
; this setsSHELL
to/bin/sh
/opt/bin/run_clair3.sh
is run bybash
, butSHELL
is still/bin/sh
run_clair3.sh
you use${SHELL}
to invoke/opt/bin/scripts/clair3_c_impl.sh
Clair3/run_clair3.sh
Line 346 in 21e7ead
/opt/bin/scripts/clair3_c_impl.sh
is run by/bin/sh
which lacks thebash
built-inreadarray
and thus failsTo fix this, I would suggest calling
${SCRIPT_PATH}/scripts/${CLAIR3_SCRIPT}
without${SHELL}
(i.e. just${SCRIPT_PATH}/scripts/${CLAIR3_SCRIPT} ... options ...
since the other scripts all have shebang lines anyway.The text was updated successfully, but these errors were encountered: