Copy several directories to another directory Copy several directories to another directory docker docker

Copy several directories to another directory


You can do:

COPY ./ /code/

It will copy everything from the current folder into the /code folder of your image.

So then you can create .dockerignore file to prevent of adding other files/directories then a, b and c. For example d, e and f are other directories in the current folder which should not be in the result image then content of the .dockerignore file will look like:

Dockerfile*def

Disadvantage of this approach is that it will copy also .dockerignore into the /code folder.