Difficulty: Beginner
Estimated Time: 10 minutes

In this scenario you will learn how to use the _--format__ parameters to pretty-print output from docker ps and docker inspect.

Formatting PS Output

Step 1 of 2

Example 1 - Names and Images as Table

The format of docker ps can be formatted to only display the information relevant to you.

Start Example Container

Start by launching a example container - docker run -d redis


The standard docker ps command outputs the name, image used, command, uptime and port information.

To limit which columns are displayed, use the _--format__ parameter. The parameter allows pretty-printing containers using a Go template syntax.

docker ps --format '{{.Names}} container is using {{.Image}} image'

As it's using Go templates, it includes helper functions such as table.

docker ps --format 'table {{.Names}}\t{{.Image}}'