user3801230
user3801230

Reputation: 143

Is it possible to identify the image from which a docker container was built?

The context to my question is as follows: I have a few docker images that I have built, and from those, I have got a few containers running, on various networks.

When I use docker inspect network <network_name>, it returns json data, containing a "Containers" structure. When I used docker run ... to create the containers, I forgot to use the --name option, so the container ID is just a long random string. As such, I can't work out what that container is.

Given this context, is it possible to identify the image from which a docker container was built?

Upvotes: 0

Views: 580

Answers (1)

Danny Hobo
Danny Hobo

Reputation: 684

Yes, you can use docker inspect , but do it on the container and not on the network:

docker inspect --format='{{.Config.Image}}' $INSTANCE_ID

where $INSTANCE_ID is the container ID

Upvotes: 2

Related Questions