The documentation of docker ps
and docker container ls
both says "List containers", but does not mention the other command. Is there a difference between those two commands?
The output looks exactly the same:
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
bbe3d7158eaa flaskmysqldockerized_web "python app.py" 5 hours ago Up 18 seconds 0.0.0.0:8082->5000/tcp flaskmysqldockerized_web_1
4f7d3f0763ad mysql "docker-entrypoint..." 6 hours ago Up 18 seconds 0.0.0.0:3307->3306/tcp flaskmysqldockerized_db_1
docker ps
is shorthand that stands for "docker process status", whilstdocker container ls
is shorthand for the more verbosedocker container list
.As the accepted answer explains, there is no difference in how they work, and
docker container ls
is the 'newer' command, so you should probably prefer it.Both commands actually only show running containers by default, which makes the first one (
docker ps
) a little more confusing as that command on its own isn't really showing 'process status'. To see the status of all containers, add the-a
option for 'all' (or use--all
), e.g.docker container ls -a
older
docker ps -a
ordocker container ps -a
There is no difference between
docker ps
anddocker container ls
. The new command structure (docker container <subcommand>
) was added in Docker 1.13 to provider a more structured user experience when using the command line.To my knowledge, there has not yet been any official announcement to drop support for the old-style commands (like
docker ps
and others), although it might be reasonable to assume this might happen at some point in the future.This is described in a blog post accompanying the release of Docker 1.13: