Docker: adding a file from a parent directory

  1. cd to your parent directory instead
  2. build the image from the parent directory, specifying the path to your Dockerfile
docker build -t <some tag> -f <dir/dir/Dockerfile> .

In this case, the context of the docker will be switched to the parent directory and accessible for ADD and COPY

Leave a Comment