Skip to content

Ignore missing build directory if not building images #7359

@vpriscan

Description

@vpriscan

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions