-
Notifications
You must be signed in to change notification settings - Fork 18.9k
Description
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.