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

Steps to reproduce the issue
- Add COMPOSE_IGNORE_ORPHANS=1 to the .env file
- 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
Description
The
COMPOSE_IGNORE_ORPHANSenv var works fordocker-compose upbut not fordocker-compose runOrphan warning is shown:
I've run this with
COMPOSE_IGNORE_ORPHANSset totrueandTrueas well, both failed.Also fails when set through env var:
Context information (for bug reports)
Steps to reproduce the issue
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