Skip to content

Docker-Compose pull fails when an image and a build directive are given and the directory does not exist #7363

@RolfZurbrugg

Description

@RolfZurbrugg

Description of the issue

When running docker-compose pull on a docker-docker compose file that has both a build directive and an image specified, docker-compose pull will fail if the directory specified in the build directive does not exist. But after creating an empty directory the pull command works.

Context information (for bug reports)

Output of docker-compose version

docker-compose version 1.25.4, build 8d51620a
docker-py version: 4.1.0
CPython version: 3.7.5
OpenSSL version: OpenSSL 1.1.0l  10 Sep 2019

Output of docker version

Client:
 Version:           18.06.3-ce
 API version:       1.38
 Go version:        go1.10.8
 Git commit:        d7080c1
 Built:             Tue Feb 19 23:07:53 2019
 OS/Arch:           linux/amd64
 Experimental:      false

Server:
 Engine:
  Version:          18.06.3-ce
  API version:      1.38 (minimum version 1.12)
  Go version:       go1.10.8
  Git commit:       d7080c1
  Built:            Tue Feb 19 23:07:53 2019
  OS/Arch:          linux/amd64
  Experimental:     false

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

docker-compose -f demo-compose.yml config
ERROR: build path /home/core/lib/support/nginx either does not exist, is not accessible, or is not a valid URL.

demo-compose.yml

version: '3'

services:
  webserver:
    build: ./lib/support/nginx
    image: nginx:latest

Steps to reproduce the issue

  1. Past the content of the demo-dompose.yml file shown above into a docker-compose.yml file.
  2. Run docker-compose pull
  3. This will cause the pull command to fail.
  4. Create an empty directory where the build path is pointing mkdir -p ./lib/support/nginx
  5. Execute docker-compose pull again, now the image is being pulled.

Observed result

core@auto-deploy-reporting-engine ~ $ docker-compose -f demo-compose.yml pull
ERROR: build path /home/core/lib/support/nginx either does not exist, is not accessible, or is not a valid URL.
core@auto-deploy-reporting-engine ~ $ sudo mkdir -p /home/core/lib/support/nginx
core@auto-deploy-reporting-engine ~ $ docker-compose -f demo-compose.yml pull
Pulling webserver ... done
core@auto-deploy-reporting-engine ~ $

Expected result

For me, the expected result would be for the docker-compose pull to work without the directory specified in the build directive needing to exist.

Additional information

OS Version

NAME="Container Linux by CoreOS"
ID=coreos
VERSION=2345.3.0
VERSION_ID=2345.3.0
BUILD_ID=2020-02-26-2211
PRETTY_NAME="Container Linux by CoreOS 2345.3.0 (Rhyolite)"
ANSI_COLOR="38;5;75"
HOME_URL="https://coreos.com/"
BUG_REPORT_URL="https://issues.coreos.com"
COREOS_BOARD="amd64-usr"

Docker-compose install method: (Running the script below as root)

#!/bin/bash

# run this script as root
mkdir /opt/
mkdir /opt/bin

LATEST_URL=`curl -Ls -o /dev/null -w %{url_effective} https://github.com/docker/compose/releases/latest`
COMPOSE_VERSION=${LATEST_URL##*/}
DOWNLOAD_URL=https://github.com/docker/compose/releases/download/${COMPOSE_VERSION}/docker-compose-`uname -s`-`uname -m`

curl -L ${DOWNLOAD_URL} -o /opt/bin/docker-compose
chmod +x /opt/bin/docker-compose

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