I have docker-compose.yml file with build context
property specified like this:
version: '3'
services:
my-service:
container_name: my-service
image: my-service
build:
context: foo
ports:
- 8088:8088
# other services
When I run docker-compose up
locally, build context does exist and everything works fine. However, my CI server is configured to use the same docker-compose.yml file but there is no build context (images are copied as .tar archive via SSH and then loaded via docker load).
Now I've got an error:
ERROR: build path /foo either does not exist, is not accessible, or is not a valid URL.
So I've tried to find a way to suppress looking for this build context when running docker-compose up
(I don't want to build images cause they are already up-to-date), but docker-compose up --no-build
does not work. Any ideas?
docker-compose.override.yml is good solution in this case. You may override only build block and this is not hard to mantain as two independent files.
docker-compose.override.yml:
version: '3'
services:
my-service:
build:
context: foo
docker-compose.yml
version: '3'
services:
my-service:
container_name: my-service
image: my-service
ports:
- 8088:8088
See https://docs.docker.com/compose/extends/
I posted your issue as a feature request on the docker-compose repository. Let's see how it progresses:
https://github.com/docker/compose/issues/7674
Meanwhile, you will have to workaround this by modifying your CI script that does the docker-compose up --no-build
so it does the mkdir -p ...
that you need.
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