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?
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
ADD command is used to copy files/directories into a Docker image. It only has only one assigned function. It can also copy files from a URL. Its role is to duplicate files/directories in a specified location in their existing format.
As Kingsley Uchnor said, you can have multiple Dockerfile , one per directory, which represent something you want to build.
It's ok to have multiple processes, but to get the most benefit out of Docker, avoid one container being responsible for multiple aspects of your overall application. You can connect multiple containers using user-defined networks and shared volumes.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With