I named my containers in Docker, but now I forgot the names...
How can I list all of the used names?
docker -ps
just gives me the running containers and docker images
gives me all the images but no names.
I just want a list where I can see how I named the different containers when I created them.
How to List Containers in Docker? 1 We have to use the Docker CLI tool to execute the command to list the containers. 2 We have two Docker commands that list the containers. 3 The first one is ‘docker container ls’ and the second one is ‘docker ps’. More items...
Use docker inspect + container id and grep user or name then you can get the Container User Name and login into the container. Thanks for contributing an answer to Stack Overflow!
Command - The default command that is executed while starting a container Created - Relative time when the container was created Status - The state of the container (will be explained later) Ports - Published ports of the container
Docker-compose can easily launch multi-container with the config file (default: docker-compose.yml ). For example, we have the following files. It is noticeable that the container’s name follow this %container_name_%s The prefix index of the container is added after the container’s name _%s.
As mentioned by @nwinkler, you use docker ps -a
to list all of your containers even stopped ones.
Now, you can also use Format in combination to docker ps -a
as a convenient way to print only part of the information that is relevant to you.
For example you can list your container IDs with their associated names with:
$ docker ps -a --format "{{.ID}}: {{.Name}}"
caee09882462: peaceful_saha
You can also use the regular table format with the column titles:
$ docker ps -a --format "table {{.ID}}\t{{.Names}}"
CONTAINER ID NAMES
caee09882462 peaceful_saha
If you only want a list of all the used names:
$ docker ps -a --format "{{.Names}}"
peaceful_saha
You can run docker ps -a
to show all running and stopped containers.
The container ID will be in the first column of the output, and the name will be in the last column.
Example:
$ 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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With