Docker: adding a file from a parent directory
cd
to your parent directory instead- 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
With docker-compose, you could set context folder:
# docker-compose.yml
version: '3.3'
services:
yourservice:
build:
context: ./
dockerfile: ./docker/yourservice/Dockerfile