简体   繁体   中英

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?

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM