Add support for adding arbitrary docker flags
Is your feature request related to a problem? Please describe. Docker has a lot of different flags, most of which are not officially supported via pants, I'd like to be able to use them without needing code changes to pants.
E.g. right now I need to add --debug to my command to see some stack traces from docker. Previously I wanted to use the cache_to/from args before they were officially in pants.
I would also like to be able to setup run args, e.g. ports to forward, volumes to map, etc.
Describe the solution you'd like I'd like docker_image and pants.toml to get some extra parameters for extra_command_line_build_args to be passed to docker build and extra_command_line_run_args to be passed to docker run.
Adding formatting for putting variables (eg homedir, pants hash, etc) into args would also be helpful.
Describe alternatives you've considered Adding every flag to pants that does not need special handling seems wasteful.
@kaos thoughts?
yes, this has been agreed before to be a good idea. the main issue has been to come up with the design for it that is intuitive to use. the unfortunate bit is that we have [docker].build_args which are for docker build --arg so not arbitrary args for the build step, while for docker run this already exists.
at this point, probably just adding it with proper docs to get it done could be acceptable. perhaps something along the lines of [docker].build_cli_args..
[...] and extra_command_line_run_args to be passed to docker run.
This is [docker].run_args.
I personally need run_args to be in the docker_image target, which I at least don't see in the docs.
I personally need run_args to be in the docker_image target, which I at least don't see in the docs.
Ah, right. No, it's only globally in configuration thus far. PR welcome to address these features if you're able to :)
Thoughts on whether the per-target option should shadow or add to the global option?