docker build -t test2 -f tests/low_conviction_integration/Dockerfile .
If I need to copy a file from a directory ABOVE my Dockerfile, I can accomplish it by calling
docker build -t image_name -f path_to_docker_file/Dockerfile .
from that ABOVE directory
How can I accomplish the same behavior with docker-compose? I want docker-compose to exist in same directory as Dockerfile, to build with Dockerfile, but to ultimately call it as if it was in ABOVE directory, so that I can copy the correct file. I tried
docker-compose -f path_to_docker_file_and_compose/docker-compose.yml up
from ABOVE directory, but when building from the Dockefile, it complains the files in ABOVE directory are not there to copy when building (which means it is running the docker build from the same directory as the Dockerfile. I need it to run the build from the ABOVE directory).
This can be done like this, add build
in docker-compose.yml and run the build from ABOVE directory:
version: '3.8'
services:
your_service:
build: # "context" and "dockerfile" fields have to be under "build"
context: .
dockerfile: <Below_Directory>/Dockerfile
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With