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/