I was trying to dockerize a nodejs application. I am adding code files to container using ADD command in Dockerfile. But i just noticed that folders named branches, objects, config, hooks are created automatically. Anybody out there know if its docker?
Asked
Active
Viewed 390 times
2 Answers
2
Found the issue. Using ADD ./* ./folder name/ instead of ADD . ./folder name created the extra folders.
But still wonder where those folders came from.

Amal
- 545
- 6
- 19
1
If your code file is in a git repo, you would have a .git subfolder that could be included by your ADD command.
That would explain the branches, hooks, ... folders.
As mentioned in "How to ADD all files/directories except hidden directory like .git in Dockerfile", you can exclude that folder with a .dockerignore
file.
-
I understand the .git folder of repo added. But, you have any idea folders named branches, objects, config, hooks are? An npm install would only create node_modules. So, where do these came from? – Amal Oct 13 '15 at 07:20
-
@Amal they should only came from a git clone. I don't know why that clone took place though – VonC Oct 13 '15 at 07:23
-
There is no git clone statement running in my docker file. Just copying files form host system to container. – Amal Oct 13 '15 at 07:27
-
@Amal but I think the ADD is the culprit: if it copies a .git folder from your host, that would explain those folder in the image built by Dockerfile. No need for a clone in the Dockerfile. There must have been a clone on your host before. – VonC Oct 13 '15 at 07:28
-
Its copying files and not cloning from git repo. – Amal Oct 13 '15 at 07:49