Skip to content
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

Attempting to remove a not created container throws a no such service error (2.3.x regression) #9255

Closed
nocive opened this issue Mar 9, 2022 · 5 comments · Fixed by #9256

Comments

@nocive
Copy link

nocive commented Mar 9, 2022

Description

Attempting to docker compose rm a not created container fails and throws a no such service: foo-service error.
This worked fine in previous 2.x versions before 2.3.x.

Steps to reproduce the issue:

  1. Remove a container with docker rm -fsv some-container
  2. Attempt to remove the same container again

Describe the results you received:
no such service: foo-service and non 0 exit status

Describe the results you expected:
0 exit status

Additional information you deem important (e.g. issue happens only occasionally):
Relates to #9241

Output of docker compose version:

Docker Compose version v2.3.3
@GrumpyRainbow
Copy link

I'm seeing the same behavior on 2.3.2.

@ndeloof
Copy link
Contributor

ndeloof commented Mar 9, 2022

Ran a quick test

services:
  foo:
    image: alpine
    command: echo hello
    depends_on:
      - bar

  bar:
    image: alpine
    command: echo hello
$ docker compose version
Docker Compose version v2.3.3
$ docker compose up
[+] Running 2/0
 ⠿ Container truc-bar-1  Created                                                                                                                                                                                                     0.0s
 ⠿ Container truc-foo-1  Created                                                                                                                                                                                                     0.0s
Attaching to truc-bar-1, truc-foo-1
truc-bar-1  | hello
truc-bar-1 exited with code 0
truc-foo-1  | hello
truc-foo-1 exited with code 0
$ docker compose rm 
docker compose rm -fsv foo
[+] Running 1/0
 ⠿ Container truc-foo-1  Stopped                                                                                                                                                                                                     0.0s
Going to remove truc-foo-1
[+] Running 1/0
 ⠿ Container truc-foo-1  Removed

Can you please provide a reproduction scenario?

@nocive
Copy link
Author

nocive commented Mar 9, 2022

Remove the service once, attempt to remove again.
Perhaps this is expected behavior now, but in previous versions it would not produce an error.

@ndeloof
Copy link
Contributor

ndeloof commented Mar 9, 2022

oh ok.
Before 2.3.x this command completed successfully with message "No stopped container".

@nocive
Copy link
Author

nocive commented Mar 9, 2022

Correct, please feel free to refine the issue description as it's not accurate :-)

Keeping the old behavior is extremely convenient for us as we have some tooling around compose that will attempt to remove a user specified list of containers upfront before building.
We can obviously work around this but it will require additional checks and I wonder if more people are not relying on the old behavior for their own tooling.

@nocive nocive changed the title Attempting to remove a non running container throws a no such service error (2.3.x regression) Attempting to remove a not created container throws a no such service error (2.3.x regression) Mar 9, 2022
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.

3 participants