cool-easter-32542
06/19/2023, 1:22 PM--platform option - #17539
• request for network and host override - https://pantsbuild.slack.com/archives/C046T6T9U/p1680209250680309
• request for --no-cache - https://pantsbuild.slack.com/archives/C046T6T9U/p1686776926633339
Creating this issue as I am happy to volunteer to implement these, but I think it's worth deciding on an approach first.
Describe the solution you'd like
It would be desirable for these options to be available on the docker_image target. In some cases, being able to set the option globally via docker backend config may also be helpful. Based on analysis below and requests above, the following options should be prioritised:
• additional host ip mappings
• network mode
• no-cache
• platform
Describe alternatives you've considered
It is possible to use a shim script around the Docker CLI as described here - https://pantsbuild.slack.com/archives/C046T6T9U/p1680209250680309, however it is more difficult to use.
Additional context
Support for buildx has also been requested. The buildx build command has different options to the standard build command.
Here is an analysis of the options across both commands, along with some suggested names (aliases) for new options.
Scope considerations
Buildx build is now the default in the latest Docker Desktop - it would be better to focus on supporting that going forward - i.e. don't implement options that are only in the standard build command.
Recommend keeping cache options out of scope of this issue as buildx support should probably be implemented first, and then need to look at implementation of --cache-from and --cache-to with Pants targets.
pantsbuild/pants