Docker-compose and .dockerignore

You have 2 Dockerfiles, which have their separate contexts. In each context (folder) you have .dockerignore, and that is correct. But .dockerignore does not work outside of build context, that means using ../../ is wrong.

I guess you are supposing these files to apply to docker folder, but in fact they apply to docker/app and docker/web respectively.

The build process is following:

First docker cli packs the context (folder with Dockerfile if not specified explicitly) and sends it to docker daemon. Nothing outside this folder is sent. It is written explicitly for COPY command, which is used to put the context items into container:

The src path must be inside the context of the build; you cannot
COPY ../something /something, because the first step of a docker build
is to send the context directory (and subdirectories) to the docker
daemon.

If there is .dockerignore, the ignored files are excluded before packing.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)