I see some unknown containers in `docker ps`

Viewed 836

When I run docker ps -a I get a list of unknown containers, with weird names

CONTAINER ID        IMAGE               COMMAND                  CREATED             STATUS                      PORTS               NAMES
744a1a910d9a        dpa:latest          "sh -c 'java $JAVA_O…"   16 seconds ago      Exited (1) 16 seconds ago                       data-pipeline-automation
7ae02b5f62b0        06f8a9fed1c7        "/bin/sh -c 'sh -c '…"   2 weeks ago         Exited (2) 2 weeks ago                          dazzling_tharp
d9461d601d37        25c5574bfe1a        "/bin/sh -c 'sh -c '…"   2 weeks ago         Exited (2) 2 weeks ago                          distracted_khorana
24e4f72731df        5e64cb808d91        "/bin/sh -c 'sh -c '…"   2 weeks ago         Exited (126) 2 weeks ago                        awesome_hypatia
b7cbb9c62ca8        5e64cb808d91        "/bin/sh -c 'sh -c '…"   2 weeks ago         Exited (2) 2 weeks ago                          youthful_snyder
9d1ac66a9d77        457a135e1fb5        "sh -c 'java $JAVA_O…"   4 weeks ago         Exited (1) 4 weeks ago                          automation

In this list the first and the last one are images I created and deployed, rest are unknown. What do the other containers in this list mean? Should I be bothered about these?

2 Answers

If your suspicousness comes from the strange names that those docker containers have, as e.g. dazzling_tharp: This is the naming scheme for docker containers that are created without the --name argument. The first part of the name is a random attribute, the second one a random noun.

E.g. docker run <image> will generate a random container name, while docker run --name my-container <image> will not. So I would assume that you created these containers playing around with docker and not using the --name argument.

You can retrieve some information about a docker container by using docker inspect <container-id>. This will e.g. show you the creation date of the container and the args it was started with. A similar command exists for inspecting images: docker inspect <image-id>.

In my experience it can be very hard to trace where a docker container/image came from. This is one of the reasons you should never give all users permissions to use the docker socket, but only a privileged user group.

No need to worry. These are containers that you have run, though, probably whilst testing/debugging something.

They can safely be deleted with docker rm <container ID>, or to clear them all, docker rm $(docker ps -aq)

Related