有没有办法否定.dockerignore中的模式? [英] is there a way to negate a pattern in .dockerignore?
问题描述
.dockerfile
*
^ Dockerfile
^ web-app / dist
但是,当我建立docker时,我有以下错误:
Dockerfile被.dockerignore模式排除*'
你知道是否可以完成我想要的?
谢谢
自版本 1.7.0 ,现在是可以的。
现在使用!
按照您的期望工作,并在官方 Dockerfile参考中记录。
以下是从上述链接获取的示例:
* / temp *
* / * / temp *
temp?
* .md
!LICENSE.md
行!LICENSE.md
将导致LICENSE.md被包含在Docker构建上下文中,尽管 *。md
规则。
I am trying to negate a pattern in a .dockerignore. The Globbing is done using Go's filepath.Match rules. After checking the source, it seems we can negate a pattern by using ^ character.
.dockerfile
*
^Dockerfile
^web-app/dist
However, when i docker build, I have the following error:
Dockerfile was excluded by .dockerignore pattern '*'
Do you know if its possible to accomplish what I want ?
Thanks
As of version 1.7.0, this is now possible.
Negating with !
now works as you would expect and is documented in the official Dockerfile reference.
Here's an example taken from the link above:
*/temp*
*/*/temp*
temp?
*.md
!LICENSE.md
The line !LICENSE.md
will cause LICENSE.md to be included in the Docker build context despite the *.md
rule.
这篇关于有没有办法否定.dockerignore中的模式?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!