Using Docker ADD command for multiples files Using Docker ADD command for multiples files docker docker

Using Docker ADD command for multiples files


The ADD command and COPY both allow Golang's filepath.Match wildcards

You can find a number of examples in the test code for Go: https://golang.org/src/pkg/path/filepath/match_test.go

Rules reproduced here for those in China who can't access Google/golang.org:

    '*'         matches any sequence of non-Separator characters    '?'         matches any single non-Separator character    '[' [ '^' ] { character-range } ']'                character class (must be non-empty)    c           matches character c (c != '*', '?', '\\', '[')    '\\' c      matches character ccharacter-range:    c           matches character c (c != '\\', '-', ']')    '\\' c      matches character c    lo '-' hi   matches character c for lo <= c <= hi


Usually, you would end up putting all the relevant files into a sub-directory, and then just ADD that directory, to bring them into the image.


Example how add files with ext .so to directory:

ADD modules/*.so /usr/local/apache2/modules/

or you can add all files in directory

ADD modules/* /usr/local/apache2/modules/