skip to Main Content

I know I can get the full container id using docker inspect --format "{{.ID}}" [container name]
I want to have the full container ID during container listing, not scripting looping one by one.

There is no way out other than scripting it myself ?

2

Answers


  1.   containerName="container-name" 
      containerID=$(docker ps -aq --filter="NAME=$containerName")
      echo containerID
    
    Login or Signup to reply.
  2. You can use --no-trunc (Don’t truncate output).

    docker ps --no-trunc

    If you want the ID only, use docker ps --no-trunc --format "{{.ID}}"

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search