I have a project structure like the following
app/
docker-compose.yml
module1/
Dockerfile
module1.py
module2/
Dockerfile
module2.py
common/
common_things.py
In my Dockerfile for module1 I have
COPY module1.py /app
COPY ../common /app/common
But Docker does not like this second line. Error is below
ERROR: Service 'module1' failed to build: COPY failed: Forbidden path outside the build context: ../common ()
How do I tell Docker, through Dockerfile or Docker-compose, that it is okay for module1 to grab files from ../common
? I could symlink common so that module1 and module2 have common in their respective dirs but that feels like overkill...
Extra credit: What is best practice for sharing files across Docker containers? Perhaps there is another way that I am unaware of.