I want to copy some files to my images and I wan to use the ADD command. I read in the Docker documentation about regular expression for ADD, but I don't know what kind of expression can I use?
I want something like this
FROM registry:5000/ubuntu:14.04
MAINTAINER Me
# some stuffs
ADD Sources/{file1,file2,load_file} /etc/Sources/
# more stuffs
Note: the expression is wrong but I did it to show you what I expect from the ADD command. (I did it thinking in shell regular expressions).
So, How can I do that? I can not access to the link filepath.Match. If anyone have these rules, please let me know?
Update
I am using this Docker docs reference
I am using this version:
Client version: 1.3.0
Client API version: 1.15
Go version (client): go1.3.3
Git commit (client): c78088f
OS/Arch (client): linux/amd64
Server version: 1.3.0
Server API version: 1.15
Go version (server): go1.3.3
Git commit (server): c78088f
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 c
character-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/