How do we see full commands in the output of docker history command?

You can add the flag --no-trunc to see the full command.


I needed to see the full build history without truncated build steps in a tabular format for debugging purposes. The Docker Docs examples are often incomplete (or non-existent). The accepted answer by @Alassane_Hdiaye can work, but throws an error if used in the wrong place. After a couple tries, I got the GoLang template table formatter to produce the result I needed.

The Docker GoLang template --format option works with docker history, but must be entered AFTER --format, because it modifies --format, NOT docker history. The docker history command takes only 1 argument. The --format option changes the output of docker history, and --no-trunc modifies the --format option.

The command sequence must be

docker history <image-id> --format <GoLang template spec> --no-trunc

The --no-trunc option follows --format on the command line, because it modifies the --format option.


So for the fully history in a tabular format:

docker history <image-id> --format "table{{.ID}}, {{.CreatedBy}}" --no-trunc

The output is messy, because Dockerfile RUN commands can wrap many lines.

So pipe the result to a CSV file and open it in Excel (for lack of a better table viewer).

docker history <image-id> --format "table{{.ID}}, {{.CreatedBy}}" --no-trunc > image-id-history.csv

So now I can see complete build instructions in Excel without truncation.


As a side note, Docker history does not output RUN and other dockerfile build keywords, but these can be inferred. But at least full commands from the complete history are available.