执行“docker ps –format”时出错。 错误:标志提供但未定义: – 格式
我已经安装docker使用以下命令:
sudo apt-get install docker.io
为了testing目的,我使用分离模式运行Ubuntu映像
sudo docker run -d -it Ubuntu
但是当我试图执行docker ps命令时
sudo docker ps --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
根据帮助页面,没有标志 – 格式被定义。 但根据https://docs.docker.com/engine/reference/commandline/ps/中的参考,我应该可以使用–format标志运行命令。
可能是什么原因 ?
补充信息
- 操作系统: Ubuntu 14.04
- docker版本: Docker版本1.6.2,build 7c8fca2
-谢谢
--format
选项只在版本1.8.0中添加到docker ps
,所以除非你能够升级,否则你将无法使用它。
如果在链接到的文档页面中明确说明了这一点非常方便,但是我想Docker只是希望您使用最新的版本 – 他们不知道为旧版本提供长期支持。