There is no difference between the docker ps
(docker process status) and docker container ls
(docker container list) commands in terms of functionality. They even allow the same set of flags. The only real difference between the two is the fact that the latter is newer and more verbose than the former.
The docker container ls
command was introduced as a part of Docker's initiative to consolidate the Docker API by grouping commands by features and concepts such as networks, volumes, containers, etc. This makes the commands more readable and obvious, and the API more intuitive and much easier for users to get started quickly.
Which Command Should You Use?
You may use either command for personal use because right now there's no signal from Docker to deprecate the docker ps
command. However, this may change in future versions. If your intention is to use the command in a script, etc. then it might make more sense to use the docker container ls
command as it is more readable and verbose, especially if you are collaborating with other developers (such as when working on an opensource project or in a team).
This post was published by Daniyal Hamid. Daniyal currently works as the Head of Engineering in Germany and has 20+ years of experience in software engineering, design and marketing. Please show your love and support by sharing this post.