0

我已经使用以下命令安装了 docker:

 sudo apt-get install docker.io

出于测试目的,我使用分离模式运行 Ubuntu 映像

sudo docker run -d -it Ubuntu

但是当我尝试执行docker ps命令时

sudo docker ps --format

我有一些错误。根据错误,标志--format未定义。以下是错误信息。

flag provided but not defined: --format
See 'docker ps --help'.

当我检查帮助页面时,我发现了这个

Usage: docker ps [OPTIONS]
List containers    
-a, --all=false       Show all containers (default shows just running)
--before=             Show only container created before Id or Name  
-f, --filter=[]       Filter output based on conditions provided
--help=false          Print usage
-l, --latest=false    Show the latest created container, include non-running
-n=-1                 Show n last created containers, include non-running
--no-trunc=false      Don't truncate output
-q, --quiet=false     Only display numeric IDs
-s, --size=false      Display total file sizes
--since=              Show created since Id or Name, include non-running

根据帮助页面,没有定义 --format 标志。但根据 https://docs.docker.com/engine/reference/commandline/ps/中的参考资料,我应该能够使用--format标志运行命令。

可能是什么原因 ?

补充资料

  • 操作系统:Ubuntu 14.04
  • 码头工人版本:码头工人版本1.6.2,构建 7c8fca2

-谢谢

4

1 回答 1

1

--format选项仅docker ps1.8.0 版本中添加,因此除非您能够升级,否则您将无法使用它。

如果在您链接到的文档页面中明确说明了这一点,那将非常方便,但我认为 docker 可能只是希望您使用最新版本 - 他们不以为旧版本提供长期支持而闻名。

于 2016-11-12T13:59:27.017 回答