Docker Community Forums

Share and learn in the Docker community.

Docker COPY missing a file during Docker Hub build

For a project I’m currently working on, automated builds are failing due to a single file not being copied from the build context into the image. Builds work fine locally and all files are copied as expected. Our Dockerfile begins like so:

FROM <organization>/<repo>:3.8.2 AS source-code

RUN mkdir ~/src

COPY --chown=<usrname> . ~/src/<github repo name>/

However, it is clear that a single file is missing from the build context, because when it is called during one of our build scripts later on in the Dockerfile, the build fails stating that the file we are trying to reference does not exist. I’ve added an ls to the Dockerfile immediately following the above COPY command, and confirmed that this single file from our GitHub repo is not being copied over. I’ve tried adding a line to explicitly copy that single file, but that has not worked either. Any ideas about what could be the source of this issue would be much appreciated.