We can search for available image files on the docker website like this:

How can I tell what the download size(s) will be prior to pulling?

docker.io pull [image]

Looking at the API for Docker, Docker Remote API v1.10, it doesn't appear there is any way to get the sizes of the images. Section "2.2 Images" shows the spec for how to query about images.


    GET /images/json?all=0 HTTP/1.1

**Example response**:

    HTTP/1.1 200 OK
    Content-Type: application/json

         "RepoTags": [
         "Id": "8dbd9e392a964056420e5d58ca5cc376ef18e2de93b5cc90e868a1bbc8318c1c",
         "Created": 1365714795,
         "Size": 131506275,
         "VirtualSize": 131506275
         "RepoTags": [
         "ParentId": "27cf784147099545",
         "Id": "b750fe79269d2ec9a3c593ef05b4332b1d1a02a62b4accb2c21d589ff2f5f2dc",
         "Created": 1364102658,
         "Size": 24653,
         "VirtualSize": 180116135

But this query needs to go against an actual Docker instance. Here's an example showing how one could use the above RESTful query:

$ echo -e "GET /images/json HTTP/1.0\r\n" | nc -U /var/run/docker.sock
HTTP/1.0 200 OK
Content-Type: application/json
Content-Length: 858
Connection: close
Date: Fri, 20 Dec 2013 16:02:41 GMT


I saw no way to query the public repositories using this particular RESTful call. The only other RESTful method that looked like you could query docker.io's images was via search, GET /images/search, but the API doesn't show any size attributes being returned for this.


  • Thanks for the insights! Hopefully the docker team will start making this info available via docker search – Sepero Jun 3 '14 at 7:20
  • 1
    @Sepero - yes I'm sure over time things such as this will get added. If this A has resolved your Q's please mark it as accepted so other's know your issue's have been resolved too. – slm Jun 3 '14 at 11:16
  • Awesome, exactly what I needed! – Brady Dowling Aug 16 '17 at 17:38

This is not a direct answer to your question but I hope it will be helpful nonetheless.

In the disk-usage script in my Docker experiments I use something like this:

docker run --entrypoint=/bin/sh $image -c 'du -sh / 2>/dev/null | cut -f1'

So you can run, e.g.:

docker run --entrypoint=/bin/sh ubuntu -c 'du -sh / 2>/dev/null | cut -f1'

Or you can download that script: disk-usage and run e.g. ./disk-usage "ubuntu busybox gcc" to have the disk usage (as reported by du -sh) displayed for those 3 images:

Image   Disk usage
-----   ----------
ubuntu  209M
busybox 2.6M
gcc     1.5G

Please note that it doesn't show the actual download required for any given image, and it will display the result after downloading the image, but it gives some idea on how bloated is a given image as compared to others.

You can run it on one machine to decide whether you want to download that images on other machines, or to use it at all.

  • 2
    Question is specifically asking for image size before "pulling". docker run causes the image to be pulled. – sepehrl Dec 7 '19 at 4:03

I know this is an old question but as of today (10/2020), the website now displays this info. If you click on the "Tags" tab it shows you the compressed size right there:

Example for ubuntu on the docker hub https://hub.docker.com/_/ubuntu?tab=tags

enter image description here


For HTTP API v2, the size is available via the tags resource under size and full_size. Here's an example URL from one of my repo's tags:


  1. For image on Docker Hub:
curl -s -H "Authorization: JWT " "https://hub.docker.com/v2/repositories/library/<image-name>/tags/?page_size=100" | jq -r '.results[] | select(.name == "<tag-name>") | .images[0].size' | numfmt --to=iec-i
  1. For image on other registry like Microsoft Container Registry. I figure out 3 ways.

    • Use docker manifest inspect to observe the manifest data, which can give you idea on how to gain the compressed size of the image.

    docker manifest inspect -v <registry-domain>/<image-name> | grep size | awk -F ':' '{sum+=$NF} END {print sum}' | numfmt --to=iec-i

    To enable docker manifest inspect, edit ~/.docker/config.json file and set experimental to enable.(Reference: docker manifest inspect)

    • Push the image to Docker Hub and you can get the compressed size of the image on Docker Hub website.

    • Use docker save to save image to a .tar file and then compress it a .tar.gz file.

docker save my-image:latest > my-image.tar

# Compress the .tar file
gzip my-image.tar

# Check the size of the compressed image
ls -lh my-image.tar.gz

If you really look into the docker code for pull operation, I think your answer is there. If the image of the container is not cached, then during pulling of the image, docker first collects the information about the image from the registry like number of layers, size of each layers etc. etc.

I would refer to read this file.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.