How to check SHA numbers?

0222

To check the SHA numbers (hashes) of Docker image layers, you can use the docker inspect command. Here’s how to do it:

Steps to Check SHA Numbers

  1. Open Your Terminal: Make sure you have Docker installed and running.

  2. Run the Inspect Command: Use the following command, replacing image_name with the name of your Docker image:

    docker inspect --format='{{.RootFS.Layers}}' image_name
    

    For example, if your image is named custom-nginx, you would run:

    docker inspect --format='{{.RootFS.Layers}}' custom-nginx
    
  3. View the Output: The command will output a list of SHA256 hashes corresponding to the layers of the specified image. It will look something like this:

    [ "sha256:abc123...", "sha256:def456...", ... ]
    

Example

If you want to inspect the SHA numbers of an image named my-image, you would execute:

docker inspect --format='{{.RootFS.Layers}}' my-image

Additional Information

  • Full Inspect Command: If you want more detailed information about the image, you can simply run:

    docker inspect my-image
    

    This will provide a comprehensive JSON output, including the SHA numbers under the RootFS section.

  • Using jq: If you have jq installed, you can format the output for better readability:

    docker inspect my-image | jq '.[].RootFS.Layers'
    

Summary

By using the docker inspect command, you can easily check the SHA numbers of the layers in a Docker image. This can help you verify integrity, troubleshoot issues, or manage layers effectively.

If you have more questions or need further assistance, feel free to ask!

0 Comments

no data
Be the first to share your comment!