Skip to content

additive build context #30101

@justincormack

Description

@justincormack

I commented on this in #29405 (comment) and below, so making an issue.

Docker build needs to accept multiple arguments to create the context, it should be modelled after eg go build not git, ie

docker build file1 file2 directory ...

This means you can construct a context additively, rather than having to use a .dockerignore file to remove parts of the context. This is especially useful if you have two Dockerfiles in the same directory that use different contexts. Currently I emulate this behaviour in every single build I do by using

tar cf - file1 file2 directory ... | docker build -

But that is much more limiting, eg you cannot use with compose, you need tar which is not on Windows etc. This change is very simple and easy to understand, and is a big improvement.

As a future enhancement, add some more tar features, especially dereference symlinks (frequently requested) and -C to change directories.

Metadata

Metadata

Assignees

No one assigned

    Labels

    area/builderBuildkind/enhancementEnhancements are not bugs or new features but can improve usability or performance.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions