-1

When I run docker ps -a I can see multiple containers.

CONTAINER ID   IMAGE                        COMMAND                  CREATED          STATUS                      PORTS                                                                    NAMES
df87493da19b   memgraph/memgraph-platform   "/bin/sh -c '/usr/bi…"   5 minutes ago    Exited (0) 5 minutes ago                                                                             sharp_proskuriakova
6038b9de9947   memgraph/memgraph-platform   "/bin/sh -c '/usr/bi…"   11 minutes ago   Exited (0) 8 minutes ago                                                                             awesome_ganguly
50057bcffba5   memgraph/memgraph-platform   "/bin/sh -c '/usr/bi…"   4 days ago       Exited (0) 11 minutes ago   0.0.0.0:3000->3000/tcp, 0.0.0.0:7444->7444/tcp, 0.0.0.0:7687->7687/tcp   keen_bardeen
711e06238325   memgraph/memgraph-platform   "/bin/sh -c '/usr/bi…"   5 days ago       Exited (0) 4 days ago                                                                                intelligent_albattani
a859e93a32cd   memgraph/memgraph-platform   "/bin/sh -c '/usr/bi…"   5 days ago       Created                                                                                              festive_burnell

I always run the Memgrpah Platform in the same way using docker run -it -p 7687:7687 -p 7444:7444 -p 3000:3000 memgraph/memgraph-platform. Why is new container created each time?

I see that they don't take up much space (docker system df) but I'd like to keep the nois to the minimum.

TYPE            TOTAL     ACTIVE    SIZE      RECLAIMABLE
Images          2         1         4.793GB   512.8MB (10%)
Containers      5         0         2.991MB   2.991MB (100%)
Local Volumes   1         0         607kB     607kB (100%)
Build Cache     55        0         2.387GB   2.387GB
GrandMel
  • 157
  • 8

1 Answers1

0

If you look at the 'status' column, you can see that all but one of the containers have the 'exited' status. Docker keeps exited containers around in case you want to see the logs from them.

To remove them one by one, you can do

docker rm <container name>

or you can remove them all in one go with

docker rm $(docker ps -aq)

(if you're on Linux).

If you want, you can tell docker to automatically remove the container when it exits by adding a --rm option on your docker run command, like this

docker run -it --rm -p 7687:7687 -p 7444:7444 -p 3000:3000 memgraph/memgraph-platform
Hans Kilian
  • 18,948
  • 1
  • 26
  • 35