“ docker ps”和“ docker ps”之间有区别吗?和“ docker container ls”? [英] Is there a difference between "docker ps" and "docker container ls"?

查看:415
本文介绍了“ docker ps”和“ docker ps”之间有区别吗?和“ docker container ls”?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

docker ps docker容器ls 都说列出容器,但没有提及其他命令。这两个命令之间有区别吗?

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?

输出看起来完全一样:

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 docker容器ls 。在Docker 1.13中添加了新的命令结构( docker container< subcommand> ),以在使用命令行时提供更结构化的用户体验。

There is no difference between docker ps and docker 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.

据我所知,目前尚未有任何官方声明放弃对老式命令(例如 docker ps 等)的支持。合理地假设这可能在将来的某个时刻发生。

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.

这在博客文章


Docker有在过去的几年中增加了许多功能,并且Docker CLI现在具有许多命令(在撰写本文时为40)。有些东西(例如构建或运行)被大量使用,有些则更加晦涩,例如暂停或历史记录。许多顶级命令会使帮助页面混乱,使制表符更难处理。

Docker has grown many features over the past couple years and the Docker CLI now has a lot of commands (40 at the time of writing). Some, like build or run are used a lot, some are more obscure, like pause or history. The many top-level commands clutters help pages and makes tab-completion harder.

在Docker 1.13中,我们将每个命令重新组合在一起,使其位于与之交互的逻辑对象下。例如,list和startof容器现在是docker容器的子命令,而history是docker image的子命令。

In Docker 1.13, we regrouped every command to sit under the logical object it’s interacting with. For example list and startof containers are now subcommands of docker container and history is a subcommand of docker image.

docker container list
docker container start
docker image history

这些更改使我们可以清理Docker CLI语法,改进帮助文本并制作Docker使用更简单。仍然支持旧的命令语法,但是我们鼓励大家采用新的语法。

These changes let us clean up the Docker CLI syntax, improve help text and make Docker simpler to use. The old command syntax is still supported, but we encourage everybody to adopt the new syntax.

这篇关于“ docker ps”和“ docker ps”之间有区别吗?和“ docker container ls”?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆