Docker Tip #24: Difference between docker ps vs docker container ls


Docker 1.13+ introduced grouped commands to help organize a bunch of Docker commands. Both commands do the same thing.

If you run docker help and are using Docker 1.13+ (which includes v17.03+) you will see both “Management Commands” and “Commands” in the help text.

Management Commands:
  container   Manage containers
  image       Manage images

  ps          List containers
  run         Run a command in a new container

The full output is much longer and if you look through the entire list of commands there are ~40 of them. It’s tough to navigate that list because those commands are associated to containers, images, networks, volumes and so on.

Docker realized that is not sustainable in the long term, so they added “Management Commands” which help categorize all of the commands and also make the commands themselves more consistent.

For example docker container ls is the new way to do docker ps. Sure it’s more typing, but it’s a lot more clear on what it does. Likewise, now you can run docker image ls, docker network ls or docker volume ls. There’s consistency across all of these commands.

Both versions of the commands do the same thing. I imagine long term, the non-grouped up commands (such as docker run) will be deprecated in favor of docker container run. There’s no sign of this happening soon, but if you use Docker 1.13+ then you should try to use the newer syntax. It’s both more descriptive and consistent.

In the Dive Into Docker course we use the new management commands.

Free Intro to Docker Email Course

Over 5 days you'll get 1 email per day that includes video and text from the premium Dive Into Docker course. By the end of the 5 days you'll have hands on experience using Docker to serve a website.