docker run -v & .dockerignore trying to ignore folder

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP

docker run -v & .dockerignore trying to ignore folder



I have a sub folder MyFolder that I add/is added with docker run -v pwd:imagefolder.


MyFolder


docker run -v pwd:imagefolder


project
- MyFolder/WithSomeFiles
- Dockerfile



So in project folder I do docker run -v (pwd):project this is adding the current folder incl. MyFolder.


project


docker run -v (pwd):project



Is it possible to ignore MyFolder when using docker run -v?


MyFolder


docker run -v



I have tried to add the folder name to .dockerignore, but it looks like that is only for Dockerfile.


.dockerignore





@SergioTulentsev Sorry I don't understand what you mean? Clearly I did not discribe the problem good enough.
– Chris G.
21 hours ago






Yes, add a bit more details.
– Sergio Tulentsev
21 hours ago





Thanks How about now, is it more clear?
– Chris G.
21 hours ago





Yep, this is better.
– Sergio Tulentsev
21 hours ago




1 Answer
1



docker run -v causes a host directory to be mounted into a container's filesystem as-is. There's no "copying" and no "ignore" facility. (It doesn't cost extra time or space to have the unwanted directory, but you also can't hide it.)


docker run -v



If this is a problem, you might need to restructure your application to keep its data somewhere other than its own source tree. If you're bind-mounting your application's code into a container you should also consider setting up a docker build pipeline and not bind-mounting your code, which can simplify some complicated bind-mount setups.


docker build






By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Comments

Popular posts from this blog

Executable numpy error

PySpark count values by condition

Trying to Print Gridster Items to PDF without overlapping contents