Skip to content

The context path of build section is required although building isn't needed #7873

@sim6

Description

@sim6

Description of the issue

docker-compose up requires context path of build section but building it isn't needed because the image was get via docker-compose pull. Also for docker-compose config.

Context information (for bug reports)

Output of docker-compose version
Installed via pip install docker-compose

docker-compose version 1.27.4, build unknown
docker-py version: 4.3.1
CPython version: 3.8.6
OpenSSL version: OpenSSL 1.1.1g  21 Apr 2020

Output of docker version
Installed via apt install docker.io

Client:
 Version:           19.03.13
 API version:       1.40
 Go version:        go1.15.2
 Git commit:        4484c46
 Built:             Tue, 22 Sep 2020 16:21:48 +0700
 OS/Arch:           linux/amd64
 Experimental:      false

Server:
 Engine:
  Version:          19.03.12
  API version:      1.40 (minimum version 1.12)
  Go version:       go1.14.7
  Git commit:       48a6621
  Built:            Mon Aug 31 05:46:39 2020
  OS/Arch:          linux/amd64
  Experimental:     false
 containerd:
  Version:          19.03.12
  GitCommit:        481103c8793316c118d9f795cde18060847c370e
 runc:
  Version:          1.0.0~rc92+dfsg1
  GitCommit:        1.0.0~rc92+dfsg1-5
 docker-init:
  Version:          0.19.0
  GitCommit:

Output of docker-compose config
(Make sure to add the relevant -f and other flags)

ERROR: build path /tmp/docker-compose-build-context-test/nonexists either does not exist, is not accessible, or is not a valid URL.

Steps to reproduce the issue

 % mkdir /tmp/docker-compose-build-context-test
 % cd /tmp/docker-compose-build-context-test
 % cat > docker-compose.yml <<<'
services:
  test-build-context:
    build:
      context: nonexists
    image: debian:stable
'
 % docker-compose pull
Pulling test-build-context ... done
 % docker-compose up  
ERROR: build path /tmp/docker-compose-build-context-test/nonexists either does not exist, is not accessible, or is not a valid URL.
 % docker-compose version 
docker-compose version 1.27.4, build unknown
docker-py version: 4.3.1
CPython version: 3.8.6
OpenSSL version: OpenSSL 1.1.1g  21 Apr 2020
 % docker-compose config
ERROR: build path /tmp/docker-compose-build-context-test/nonexists either does not exist, is not accessible, or is not a valid URL.

Observed result

The context path of the build secction is needed when build is not required.

Expected result

Ignore build section and start the container.

Stacktrace / full error message

 % docker-compose --verbose up    
compose.config.config.find: Using configuration files: ./docker-compose.yml
ERROR: compose.cli.main.main: build path /tmp/docker-compose-build-context-test/nonexists either does not exist, is not accessible, or is not a valid URL.

Additional information

docker-compose installed via pip install docker-compose on Debian unstable.

 % cat /etc/debian_version 
bullseye/sid
 % apt list docker.io
Listing... Done
docker.io/testing,now 19.03.13+dfsg1-2 amd64 [installed]

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions