docker/compose

docker-compose rm container after docker-compose run

Closed this issue · 5 comments

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

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 notifications@github.com a
écrit :

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


Reply to this email directly or view it on GitHub
#2568 (comment).

@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"