我打算从 docker 映像中排除 python 生成的文件。所以我.dockerignore在上下文目录的根目录下添加了:
# Ignore generated files
*.pyc
Alasdocker build忽略了这一点,并复制了如下所示的整个目录树:
/contextdir/
|-- Dockerfile
\-- src/
|-- a.py # this is copies - all right
\-- a.pyc # this should be ignored, but is copied too. Why?