How to see docker image contents

前端 未结 9 1205
说谎
说谎 2020-11-30 16:18

I did a docker pull and can list the image that\'s downloaded. I want to see the contents of this image. Did a search on the net but no straight answer.

9条回答
  •  不知归路
    2020-11-30 16:43

    You can just run an interactive shell container using that image and explore whatever content that image has.

    For instance:

    docker run -it image_name sh
    

    Or following for images with an entrypoint

    docker run -it --entrypoint sh image_name
    

    Or, if you want to see how the image was build, meaning the steps in its Dockerfile, you can:

    docker image history --no-trunc image_name > image_history
    

    The steps will be logged into the image_history file.

提交回复
热议问题