Skip to content

docker-compose create suggests --remove-orphans, which doesn't work #9718

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
codl opened this issue Aug 4, 2022 · 5 comments · Fixed by #10160
Closed

docker-compose create suggests --remove-orphans, which doesn't work #9718

codl opened this issue Aug 4, 2022 · 5 comments · Fixed by #10160

Comments

@codl
Copy link

codl commented Aug 4, 2022

Description

If it finds orphaned containers, docker-compose create will suggest running again with --remove-orphans, which is not a flag that create accepts.

Steps to reproduce the issue:

  1. docker-compose create
  2. change the name of a service
  3. docker-compose create again, which will complain:
    WARN[0000] Found orphan containers ([foo, bar]) 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.
    
  4. docker-compose create --remove-orphans

Describe the results you received:

$ docker-compose create --remove-orphans
unknown flag: --remove-orphans

Describe the results you expected:
Orphaned containers are removed.

Output of docker compose version:

Docker Compose version 2.9.0

Output of docker info:

Client:
 Context:    default
 Debug Mode: false
 Plugins:
  buildx: Docker Buildx (Docker Inc., v0.8.2-docker)
  compose: Docker Compose (Docker Inc., 2.9.0)

Server:
 Containers: 6
  Running: 4
  Paused: 0
  Stopped: 2
 Images: 66
 Server Version: 20.10.17
 Storage Driver: btrfs
  Build Version: Btrfs v5.18.1
  Library Version: 102
 Logging Driver: json-file
 Cgroup Driver: systemd
 Cgroup Version: 2
 Plugins:
  Volume: local
  Network: bridge host ipvlan macvlan null overlay
  Log: awslogs fluentd gcplogs gelf journald json-file local logentries splunk syslog
 Swarm: inactive
 Runtimes: io.containerd.runtime.v1.linux runc io.containerd.runc.v2
 Default Runtime: runc
 Init Binary: docker-init
 containerd version: 10c12954828e7c7c9b6e0ea9b0c02b01407d3ae1.m
 runc version: 
 init version: de40ad0
 Security Options:
  seccomp
   Profile: default
  cgroupns
 Kernel Version: 5.15.55-2-lts
 Operating System: Arch Linux
 OSType: linux
 Architecture: x86_64
 CPUs: 8
 Total Memory: 7.456GiB
 Name: peanut.codl.fr
 ID: HTBR:M3DN:3IFA:VREG:7FMW:REU4:X23W:UUSQ:33P4:WQ74:CZTP:IHAT
 Docker Root Dir: /var/lib/docker
 Debug Mode: false
 Registry: https://index.docker.io/v1/
 Labels:
 Experimental: false
 Insecure Registries:
  127.0.0.0/8
 Live Restore Enabled: false
@matthewarmand
Copy link
Contributor

matthewarmand commented Aug 9, 2022

FYI, the only compose commands I've found in the docs that support --remove-orphans are up and down.

Docs:

https://docs.docker.com/engine/reference/commandline/compose_down/

https://docs.docker.com/engine/reference/commandline/compose_up/

I've run into this with docker compose run..... as well, so I think the message really just needs to change from:

you can run this command with the --remove-orphans flag to clean it up.

to:

you can run 'docker compose up/down --remove-orphans' to clean it up.

Unless maintainers want to add --remove-orphans support to all commands which trigger this message.

@KyGost
Copy link

KyGost commented Jan 7, 2023

Still an issue

@ndeloof
Copy link
Contributor

ndeloof commented Jan 10, 2023

message indeed suggests to use --remove-orphans which is a compose up flag.
simplest option is to introduce this flag in compose create as well

@matthewarmand
Copy link
Contributor

@ndeloof, as noted in the comments above, this message also shows on run. Should support for the option be added to that command as well?

@matthewarmand
Copy link
Contributor

matthewarmand commented Jan 11, 2023

@ndeloof I naively followed your example on the run command and opened a PR if that's helpful: #10166

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants