Viewing Docker Image Contents

Snippet

Okay, so, you want to view the contents of a Docker image. Do not start / run the image to view its contents if you don't know what the contents are.

Instead, use docker create:

The docker create command creates a writeable container layer over the specified image and prepares it for running the specified command. The container ID is then printed to STDOUT . This is similar to docker run -d except the container is never started.

# create but don't run the the image
docker create --name="thisisatempname" image:tag 
 
# run export to view the contents, pipe to the tar command in table of contents mode and paginate with less
docker export thisisatempname | tar t | less
 
# clean up 
docker rm thisisatempname

Add new comment

Plain text

  • No HTML tags allowed.
  • Lines and paragraphs break automatically.