例外.dockerignore [英] Exceptions in .dockerignore
本文介绍了例外.dockerignore的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何 .dockerignore
处理异常?
例如,我想忽略来自 src /
目录除了 src / web / public
。
For example, I would like to ignore everything from the src/
directory except for src/web/public
.
我试过...
.git
src
!src/web/public
似乎无法工作。
docker build。
显示将构建上下文发送到Docker守护程序20.63 MB
任何一种。
推荐答案
不会出现 .dockerignore
处理异常。如果有一个众所周知的语法,您可以提出更改并使其成为拉请求。
It does not appear that .dockerignore
handles exceptions. If there is a well-known syntax for this, you could propose the change and make a pull request.
在 tag 1.3 of commands.go 我们看到:
ignore, err := ioutil.ReadFile(path.Join(root, ".dockerignore"))
// ...
options := &archive.TarOptions{
Compression: archive.Uncompressed,
Excludes: excludes,
}
context, err = archive.TarWithOptions(root, options)
以及存档。 go :
for _, include := range options.Includes {
// ...
skip, err := fileutils.Matches(relFilePath, options.Excludes)
if err != nil {
log.Debugf("Error matching %s", relFilePath, err)
return err
}
if skip {
if f.IsDir() {
return filepath.SkipDir
}
return nil
}
// ...
}
这篇关于例外.dockerignore的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文