There's a command to list images, docker images
, but there doesn't seem to be a corresponding docker containers
.
Other than becoming root and looking into /var/lib/docker
there doesn't seem a way to do that. Am I missing something? Is that something one isn't supposed to do?
docker ps -s will show the size of running containers only.
To check the size of all containers use
docker ps -as
To list only the containers SHA1:
That way, you can use the list of all containers for other commands (which accept multiple container ids as parameters).
For example, to list only the name of all containers (since
docker ps
list only their names with other information):It is always recommended to add the user in a Docker group.
That can be done like:
There are also the following options:
since: 1.13.0 (2017-01-18):
and as stated here: Introducing Docker 1.13, users are encouraged to adopt the new syntax:
Note that some time ago there was an update to this command. It will not show the container size by default (since this is rather expensive for many running containers). Use
docker ps -s
to display container size as well.To show only running containers use the given command:
To show all containers use the given command:
To show the latest created container (includes all states) use the given command:
To show n last created containers (includes all states) use the given command:
To display total file sizes use the given command:
The content presented above is from docker.com.
In the new version of Docker, commands are updated, and some management commands are added:
Is used to list all the running containers.
Is used to list all the containers created irrespective of its state.
Here container is the management command.