CHINMAYA DEHURY
CHINMAYA DEHURY

Reputation: 135

Error executing "docker ps --format". Error: flag provided but not defined: --format

I have install docker using following command:

 sudo apt-get install docker.io

for testing purpose, I run a Ubuntu image in detached mode using

sudo docker run -d -it Ubuntu

But when I tried to execute docker ps command like

sudo docker ps --format

I got some error. According to the error, the flag --format is not defined. Following is the error message.

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

When I check for the help page I found this

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

According to help page, there is no flag --format is defined. But according to the reference in https://docs.docker.com/engine/reference/commandline/ps/ , I should be able to run the command with --format flag.

What could be the reason ?

Supplementary Information

-Thank you

Upvotes: 0

Views: 1123

Answers (1)

joelnb
joelnb

Reputation: 1494

The --format option was only added to docker ps in version 1.8.0 so unless you are able to upgrade then you won't be able to use it.

It would be quite handy if this was made clear in the documentation page you linked to but I think probably docker just expect you to use the latest version - they are not known for providing long term support for older versions.

Upvotes: 1

Related Questions