Reputation: 421
I have a docker-compose file that has the following services in it:
service1:
privileged: true
image: storjlabs/billing
build:
context: ../
dockerfile: ../../service1/dockerfiles/service1-development.dockerfile
service2:
privileged: true
build:
context: ../
dockerfile: ./dockerfiles/service2-development.dockerfile
Is there a way to access files outside of the docker context?
If I try it now, I get an error that says ERROR: Forbidden path outside the build context
and spits out the file path. I know I can edit the context to get this to work, but that feels wrong to do and I'm worried about far reaching consequences that might have in our build process.
Any suggestions would be greatly appreciated.
Upvotes: 2
Views: 5438
Reputation: 24775
Docker now allows having the Dockerfile outside the build context (fixed in 18.03.0-ce, https://github.com/docker/cli/pull/886). So you can also do something like
docker build -f ./Dockerfile ../context
Upvotes: 2