Get container names in Docker

I named my containers in Docker, but now I forgot the names ...

How can I list all the names used?

docker -psjust gives me running containers, but docker imagesgives me all the images, but not the names.

I just need a list where I can see what I called the different containers when I created them.

+4
source share
2 answers

As @nwinkler already mentioned, you use docker ps -ato list all your containers, even stopped ones.

Now you can also use the Format in combination with docker ps -aas a convenient way to print only part of the information relevant to you.

, :

$ docker ps -a --format "{{.ID}}: {{.Name}}"
caee09882462: peaceful_saha

:

$ docker ps -a --format "table {{.ID}}\t{{.Names}}"

CONTAINER ID        NAMES
caee09882462        peaceful_saha

:

$ docker ps -a --format "{{.Names}}"
peaceful_saha
+5

docker ps -a, .

, .

:

$ docker ps -a
CONTAINER ID  IMAGE                    COMMAND                  CREATED       STATUS                    PORTS                                                     NAMES
6b74154d7133  wnameless/oracle-xe-11g  "/bin/sh -c '/usr/sbi"   9 months ago  Exited (0) 13 days ago    8080/tcp, 0.0.0.0:49160->22/tcp, 0.0.0.0:49161->1521/tcp  oracle_xe
+2

Source: https://habr.com/ru/post/1663628/