Compose: docker-compose rm container after docker-compose run

Created on 22 Dec 2015  Â·  5Comments  Â·  Source: docker/compose

Hello,

I have a simple docker-compose.yml

helloworld:
  build: .

I run

docker-compose run helloworld

The container run and exit, then I would like to delete this container.
I tried

docker-compose rm -f -v helloworld

but it's not working:

> docker-compose rm -f helloworld
No stopped containers

But the container is there:

CONTAINER ID        IMAGE               COMMAND                   CREATED             STATUS                      PORTS               NAMES
a7776041eece        sample_helloworld   "/bin/sh -c 'echo \"He"   40 seconds ago      Exited (0) 40 seconds ago                       sample_helloworld_run_1

If I run the compose with docker-compose up, I can do docker-compose rm -f -v helloworld

I know I can do docker-compose run --rm helloworld but I would like to know if this behaviour is correct?

Thanks

duplicate

Most helpful comment

Try "docker-compose down" to clear the container that run with "docker-compose up"

All 5 comments

It is correct. #2184 is an issue to include a way to remove run containers as well

Thanks Daniel I'll follow this issue!

Le mar. 22 déc. 2015 17:31, Daniel Nephin [email protected] a
écrit :

It is correct. #2184 https://github.com/docker/compose/issues/2184 is
an issue to include a way to remove run containers as well

—
Reply to this email directly or view it on GitHub
https://github.com/docker/compose/issues/2568#issuecomment-166666884.

@dnephin Can we reopen this? #2184 has been closed because the reported switched to #2593 but that seems to cover a different situation (though maybe it's the same code?)

True, there are two related but slightly different issues here. I've opened #2774 to document the problem and proposed solutions.

Try "docker-compose down" to clear the container that run with "docker-compose up"

Was this page helpful?
0 / 5 - 0 ratings