-
-
Notifications
You must be signed in to change notification settings - Fork 64
Description
Simple example, how can I do something like docker run does? You have to specify all the options after run, and then the positional argument which is the image. After, it passes all the remaining arguments (options or not) to the container's entrypoint.
The only way I could accomplish this is by using ARG_POSITIONAL_DOUBLEDASH in my templates, then ensuring the customers don't forget to put --. Example:
Imagine I have a entrypoint.sh in my docker image made with argbash. And also, I have another script called run.sh (also argbash powered), which finds a script in the container and run it. So both entrypoint.sh and run.sh needs ARG_LEFTOVERS.
docker run -ti felipe run.sh another_script.sh -v
It was supposed to pass -v as argument of another_script, but what happens is that the -v is consumed by the entrypoint.sh, which prints its version instead of running run.sh. The way to solve is:
docker run -ti felipe -- run.sh -- another_script.sh -v
But this doesn't seems elegant. I think the best approach would be to treat all the arguments after the positionals as leftovers, just if ARG_LEFTOVERS is specified in template.