Skip to content

Docker ENTRYPOINT script logic is buggy #628

Open
@KetchupBomb

Description

@KetchupBomb

#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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions