Compose: Ignore missing build directory if not building images

Created on 13 Apr 2020  路  4Comments  路  Source: docker/compose

Hello,
We have a single Compose file that should be used for both building images and starting services.
Images are built on one machine (manually or with CI/CD) and pushed to company's private Docker registry.

Compose file snippet:

version: "3.7"
services:
    standalone:
        build:
          context: build/wildfly/standalone
        ...

We want to be able to start the services with _docker-compose_ CLI on any other machine in our company, using the same Compose file, while pulling the previously built images from company's private Docker registry.

Those other machines don't have access to the build files, only the Compose file.
The problem is, when starting services with up, build path specified in the Compose file must exist, otherwise an error is thrown, even if building is not required or is explicitly turned off with --no-build.

docker-compose -f all-standalone-demo.yml up --no-build
ERROR: build path /home/vpriscan/...../build/wildfly/standalone either does not exist, is not accessible, or is not a valid URL.

I propose that missing build directory is ignored when services being started don't require building the images, or alternatively if --no-build flag is present.

Kind regards,
Vedran

kinfeature

Most helpful comment

@vpriscan I've submmited a PR #7564 to attempt solve this issue.

I hope that my fix strategy can be considered appropriate. Unfortunately I'm not sure when any maintainers can take a look at that.

All 4 comments

Yup, this would be great!

The same underlying problem is present for pull as just reported by @RolfZurbrugg in https://github.com/docker/compose/issues/7363

I'd like to try to fix this behavior with my first contribution here :)

Since no maintainers commented in this thread, I guess this feature still needs a approval to be converted to a possible future merge.

@vpriscan I've submmited a PR #7564 to attempt solve this issue.

I hope that my fix strategy can be considered appropriate. Unfortunately I'm not sure when any maintainers can take a look at that.

Was this page helpful?
0 / 5 - 0 ratings