To list both running and stopped containers, use the -a option as follows:
To return just the container IDs of all containers, use the -aq option as follows:
To show the last created container, including non-running containers, run the following command:
$ docker container ls -l
Using the --filter/-f option to ps, we can list containers with specific labels. Look at the Labelling and filtering containers recipe in this chapter for more details.