docker - Docker COPY cmd that respects .dockerignore?
问题描述
I have a folder tmpdata
with slightly different permissions at the top level of my project, which is used by a separate container to be able to restart with data.
I list this tmpdata/
folder in my .dockerignore
file because I don't want it to be part of the build for the main app.
In my Dockerfile, I do have a COPY . .
directive though. I thought it would copy everything except whatever's listed in .dockerignore, but when I try to build, I get:
failed to solve with frontend dockerfile.v0: failed to read dockerfile: error from sender: open tmpdata: permission denied
My question is, why isn't the .dockerignore
file preventing the build process from even trying to touch this folder? Is there a way to have the COPY command respect (ignore) entries in the .dockerignore
file?
UPDATE even after refactoring the dockerfile to use selective COPY
commands that only copy needed files, docker build still fails, complaining about the same tmpdata
folder.
UPDATE 2 my docker ignore file:
.dockerignore
docker-compose.yml
.env
.env.*
.git
test/
src/test/
**/*.spec.*
**/*.test.*
**/node_modules/
npm-debug.log
.gitignore
.cache
.DS_Store
.thumbsdb
dist/
_unused/
.vscode/
**/*.md
**/.git
tmpdata/
解决方案
推荐阅读
- sql - ORA:01821: 插入记录时无法识别日期格式
- amazon-web-services - 将已在 S3 中的文件放入文件夹中
- node.js - 每当我尝试将服务器添加到用户模型时,Sequelize 不会在直通/联结表中添加记录
- python - 编写一个函数longestWord(),它接收一个单词列表,然后返回以“ion”结尾的最长单词
- json - sed 帮助:如何仅当在另一个匹配行范围内找到时打印一系列行
- javascript - 当我将 Google App 脚本嵌入 iFrame 时,为什么有些页面可以工作而有些页面不能工作
- docker - 在运行的 docker 容器中安装包
- javascript - Cheerio 查找功能包括祖先和后代
- c# - 如何重构这些相同的逻辑结构?
- git - 禁用 Git 全局用户名和电子邮件