I mount my project as volume, and i want to tell docker to ignore git and phpstorm files when building or any solution to let me commit files to git after.
I tried the .dockerignore file solution but i found git files in the running container :(
this is my dockerignore file code (placed in the root)
.git
any help please ?
Docker volumes work at the filesystem level, they are a direct mapping of a directory into your container.
The .dockerignore file is used to affect what the docker client sends to the docker host for your image build (aka the build context).
These are two different phases of docker. The build time creates your image. While the volume at run time affects the container. So you cannot control a host volume mount with the .dockerignore file.
What you can do is add the files to your image. If you also need those files in a volume, you can initialize a named volume with the state of the image, but that only happens when the volume is empty and won't pickup changes made later.