Skip to content

The cp command does not detect stopped containers #9005

@ciaranmcnulty

Description

@ciaranmcnulty

Description

In our CI environment we want to do something like this to attach test reports to builds:

docker compose run test-toolbox run_tests.sh
docker compose cp test-toolbox:/reports ./ci-output

Describe the results you received:

This fails because the container used in the run is in a stopped state

service test-toolbox not running

Describe the results you expected:

Because we didn't do --rm , files copied to the host

Additional information you deem important (e.g. issue happens only occasionally):

On slack @ndeloof suggested it was this listing that needs to also find stopped containers https://github.com/docker/compose/blob/v2/pkg/compose/cp.go#L74

This happens locally and on our gitlab runners

Output of docker-compose --version:

Docker Compose version v2.1.1

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions