Reputation: 350
Ive been learning about Docker for the last months, I was watching one training tutorial on udemy. I did docker ps -a to check the containers I have (all of them) and for learning purposes I was looking for a command that gives me the full container id of a container.
Lets say that from this picture, I want the full container_id of: 8a7815ffd059
thanks in advance!
Upvotes: 3
Views: 1881
Reputation: 2616
Directly with the ps command:
docker ps --no-trunc
With inspect:
docker inspect 8a78 | grep Id
Upvotes: 6
Reputation: 10891
This command should give you what you want:
docker container inspect --format "{{.Id}}" 8a78
and nothing besides the container id (e.g., no cruft to sort through)
Upvotes: 1
Reputation: 6643
Lets say that from this picture, I want the full container_id of: 8a7815ffd059
docker inspect 8a78 | grep Id
Upvotes: 1
Reputation: 47279
If you do:
docker inspect ${the id you get in docker ps}
You get a pretty big json with all the details about the container. The first key in the object is Id
, which is what you are looking for
Upvotes: 0