Skip to content

[BUG] New 2.18 releases fails to build images when runnig up --build #10574

@ghost

Description

Description

This command: docker compose -f docker-compose-testing.yaml up -d --build was working properly with 2.17 version.
With 2.18 it returns: Error: No such image:

Simplified compose and dockerfile contents to reproduce:

  • docker-compose-testing.yaml file contents:

    services:
      core:
        container_name: Project_Test
        build:
          context: .
          target: base
        image: project_test
        platform: linux/amd64
        environment:
          - MY_ENVARS=my_values
        restart: on-failure
  • Dockerfile file contents:

    FROM python:3.10-alpine as base
    WORKDIR /service
    COPY Pipfile* /service/
    RUN pip install --upgrade pip
    RUN pip install --upgrade wheel
    RUN pip install --no-cache-dir pipenv
    RUN pipenv install --deploy
  • pipfile file contents:
    (Not really required as the problem comes before attempting to build the dockerfile but shared for completeness)

    [[source]]
    url = "https://pypi.org/simple"
    verify_ssl = true
    name = "pypi"
    
    [packages]
    flask = "*"
    
    [dev-packages]
    mypy = "*"
    
    [requires]
    python_version = "3.10"
    

Steps To Reproduce

Deploy latest version of docker compose from repository at a local folder, my_compose while keeping the previous installed version on system:

(Or some other way get both versions installed)

myusername@localhost compose_problem % docker compose version
Docker Compose version v2.17.3
myusername@localhost compose_problem % ./my_compose/docker-compose version
Docker Compose version v2.18.0

With the previously shared files run both docker compose up command on both versions:
(Without a prior build)

myusername@localhost compose_problem % docker compose version
Docker Compose version v2.17.3

myusername@localhost compose_problem % ./my_compose/docker-compose version
Docker Compose version v2.18.0

myusername@localhost compose_problem % ./my_compose/docker-compose -f docker-compose-testing.yaml up -d --build
Error: No such image:

myusername@localhost compose_problem % docker compose -f docker-compose-testing.yaml up -d --build
[+] Building 1.8s (3/3) FINISHED
 => [internal] load .dockerignore                           0.0s
 => => transferring context: 2B                             0.0s
 => [internal] load build definition from Dockerfile        0.0s
 => => transferring dockerfile: 240B
 ...

This example was made on a MAC but same commands -> same behaviour observed on Linux.

Compose Version

Docker Compose version v2.18.0

Docker Environment

No response

Anything else?

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions