Home > Blockchain >  List docker containers including full container id instead of short one
List docker containers including full container id instead of short one

Time:07-26

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 ?

CodePudding user response:

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}}"

CodePudding user response:

  containerName="container-name" 
  containerID=$(docker ps -aq --filter="NAME=$containerName")
  echo containerID
  • Related