Dockerfile does not conform to entrypoint best practice #8#9
Dockerfile does not conform to entrypoint best practice #8#9ozbillwang wants to merge 3 commits intomasterfrom
Conversation
|
Could you review this PR? |
muppet3000
left a comment
There was a problem hiding this comment.
Whilst this works for the best part. It doesn't fix the specific case that causes the problems with things like Jenkins/Automation jobs running it.
For example, Jenkins starts a container by running a "cat" command, leaving the container to run in the background and then the actual commands it wants to run it runs using "exec" commands.
In the case of the code that you have added it will execute "cat" as an argument to "git" and subsequently fail.
There are a couple of options here, either, take the easy route and add "cat" to the list of commands to run in isolation e.g. "sh, bash" but that'll then break when someone wants to run "ls". The more complex, but more complete solution is to use the output of "compgen -c" (prints all executables on the path) and check if $1 is in the list, if it is execute it, otherwise, pass everything as an argument to "git".
The downside of the latter solution is that you have to add compgen to your image (which, if you're trying to keep it minimal is more bloat).
Another note - since "sh" is available in Alpine it is not mandatory to provide bash, which no doubt will cause your image to grow more than you'd like, seeing as you started with alpine I'm guessing you wanted it as small as possible.
Sorry I haven't been able to do the PR myself, been manic outside of work and I'm unable to work on it during work hours!
|
let's follow #10 for the same request. |
docker-entrypoint.shto conform to entrypoint best practice