5

It is a complement of this question, where the typical solution is to use the command sudo docker container ls that displays

CONTAINER ID        IMAGE                 COMMAND                  CREATED             ...
4114e655e2b1        xx/yy                 "/bin/sh -c 'exec po…"   3 days ago          ... 

The problem here is how can I see the full COMMAND column content?

PS: no one use the --format option, how do I use it in the simplest plug-and-play way?

Zeitounator
  • 38,476
  • 7
  • 53
  • 66
Peter Krauss
  • 13,174
  • 24
  • 167
  • 304
  • 1
    `docker ps --no-trunc --format "{{.Command}}"` – Adiii Nov 29 '19 at 15:22
  • Another option is you could use something like -> https://www.portainer.io/ you can then click on the container and get way more info than can practically be displayed on a single line of a terminal. – Keith Nov 29 '19 at 16:11

2 Answers2

8

To see the full command output, you have to use the --no-trunc option

docker container ls --no-trunc

Now if you want to reduce the output to the info you find relevant, you can use the --format option. Here is an example for name and command (inspired from https://container42.com/2016/03/27/docker-quicktip-7-psformat/):

docker container ls --no-trunc --format '{{.Names}}\t{{.Command}}'
Zeitounator
  • 38,476
  • 7
  • 53
  • 66
1

docker inspect $containerID --format '{{.Path}} {{.Args}}' - where $containerID is your container's id.

docker inspect is a really handy tool that can tell you a lot about your container / image.