Skip to content
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 ENTRYPOINT script logic is buggy #628

Open
KetchupBomb opened this issue May 28, 2024 · 0 comments
Open

Docker ENTRYPOINT script logic is buggy #628

KetchupBomb opened this issue May 28, 2024 · 0 comments

Comments

@KetchupBomb
Copy link

#573 added an ENTRYPOINT which invokes command:

command -v -- "$1" >/dev/null 2>&1 || set -- docker-gen "$@"

Based on the comments I could follow in the PR(s), it seems like the purpose was to distinguish between executable and non-executable arguments from COMMAND. A problem, I believe, is that the -v flag is a little too liberal in checking what is "executable", and that causes invoking this Docker image to fail on reasonable input.

Consider the following REPL:

$ docker run -it --rm -v /var/run/docker.sock:/tmp/docker.sock:ro --entrypoint ash nginxproxy/docker-gen
$ echo Hello world > template.tmpl

$ docker-gen /template.tmpl 
Hello world

$ /app/docker-entrypoint.sh /template.tmpl 
/app/docker-entrypoint.sh: exec: line 8: /template.tmpl: Permission denied

Invoking docker-gen with just a template works, but going through the ENTRYPOINT script fails. IMO the Docker image ought to be able to be called in this manner.

This logic can be avoided by passing even a single argument to the ENTRYPOINT script:

$ /app/docker-entrypoint.sh -watch /template.tmpl 
Hello world
2024/05/28 07:33:17 Watching docker events
Hello world

But that's just masking what I believe to be incorrect underlying logic. Thanks for considering the issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant