grimmjow_sms
grimmjow_sms

Reputation: 350

Docker: How can I get the complete container id of a existing container?

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.

docker ps -a

Lets say that from this picture, I want the full container_id of: 8a7815ffd059

thanks in advance!

Upvotes: 3

Views: 1881

Answers (4)

niekname
niekname

Reputation: 2616

Directly with the ps command:

docker ps --no-trunc

With inspect:

docker inspect 8a78 | grep Id

Upvotes: 6

emory
emory

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

Const
Const

Reputation: 6643

Lets say that from this picture, I want the full container_id of: 8a7815ffd059

docker inspect 8a78 | grep Id

Upvotes: 1

Mario F
Mario F

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

Related Questions