Skip to content

COMPOSE_IGNORE_ORPHANS doesn't work for docker-compose run #9323

@lobabob

Description

@lobabob

Description

The COMPOSE_IGNORE_ORPHANS env var works for docker-compose up but not for docker-compose run

Orphan warning is shown:

$ cat .env
COMPOSE_IGNORE_ORPHANS=1
$ docker-compose run --rm nginx
WARN[0000] Found orphan containers ([***, ***, ***]) for this project. If you removed or renamed this service in your
 compose file, you can run this command with the --remove-orphans flag to clean it up.

I've run this with COMPOSE_IGNORE_ORPHANS set to true and True as well, both failed.

Also fails when set through env var:

$ COMPOSE_IGNORE_ORPHANS=1 docker-compose run --rm nginx
WARN[0000] Found orphan containers ([***, ***, ***]) for this project. If you removed or renamed this service in your
 compose file, you can run this command with the --remove-orphans flag to clean it up.

Context information (for bug reports)

$ docker-compose version
Docker Compose version v2.3.3
$ docker --version
Docker version 20.10.13, build a224086
$ docker version
Client:
 Cloud integration: v1.0.22
 Version:           20.10.13
 API version:       1.41
 Go version:        go1.16.15
 Git commit:        a224086
 Built:             Thu Mar 10 14:08:44 2022
 OS/Arch:           darwin/amd64
 Context:           default
 Experimental:      true

Server: Docker Desktop 4.5.0 (74594)
 Engine:
  Version:          20.10.12
  API version:      1.41 (minimum version 1.12)
  Go version:       go1.16.12
  Git commit:       459d0df
  Built:            Mon Dec 13 11:43:56 2021
  OS/Arch:          linux/amd64
  Experimental:     false
 containerd:
  Version:          1.4.12
  GitCommit:        7b11cfaabd73bb80907dd23182b9347b4245eb5d
 runc:
  Version:          1.0.2
  GitCommit:        v1.0.2-0-g52b36a2
 docker-init:
  Version:          0.19.0
  GitCommit:        de40ad0

image

Steps to reproduce the issue

  1. Add COMPOSE_IGNORE_ORPHANS=1 to the .env file
  2. Run any docker-compose run command with orphaned containers existing under your project name

Observed result
WARN[0000] Found orphan containers ([***, ***, ***]) for this project.... warning is shown.

Expected result
No warning is shown.

Additional information
macOS, docker-compose installed via auto-updating Docker for Mac to the recent version

Metadata

Metadata

Assignees

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