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]

7 Answers 7


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
    Commented Jun 3, 2014 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
    Commented Jun 3, 2014 at 11:16
  • Awesome, exactly what I needed! Commented Aug 16, 2017 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.

  • 3
    Question is specifically asking for image size before "pulling". docker run causes the image to be pulled.
    – sepehrl
    Commented Dec 7, 2019 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.



Getting compressed image size before pull for any registry that serves Image Manifest V2:

  • Uses docker manifest inspect (available by default in recent Docker versions)
  • Parses and sums layer sizes from the manifest using jq
  • Formats sizes to iec standard using numfmt (not si, sizes in manifests are 1024-based)
  • Supports multi-arch manifests
$ dockersize() { docker manifest inspect -v "$1" | jq -c 'if type == "array" then .[] else . end' |  jq -r '[ ( .Descriptor.platform | [ .os, .architecture, .variant, ."os.version" ] | del(..|nulls) | join("/") ), ( [ .SchemaV2Manifest.layers[].size ] | add ) ] | join(" ")' | numfmt --to iec --format '%.2f' --field 2 | sort | column -t ; }

$ dockersize mcr.microsoft.com/dotnet/core/samples:dotnetapp-buster-slim
linux/amd64  72.96M

$ dockersize ghcr.io/ddelange/pycuda/runtime:3.9-master
linux/amd64  1.84G
linux/arm64  1.80G

$ dockersize python
linux/amd64                    334.98M
linux/arm/v5                   308.21M
linux/arm/v7                   295.69M
linux/arm64/v8                 326.32M
linux/386                      339.74M
linux/mips64le                 314.88M
linux/ppc64le                  343.86M
linux/s390x                    309.52M
windows/amd64/10.0.20348.825   2.20G
windows/amd64/10.0.17763.3165  2.54G
  • For Debian users: apt-get install jq
  • For Mac users: brew install coreutils jq (coreutils ships numfmt)
  • 1
    Thank you, this was helpful. I only had to remove '.' from the format due to the error on RedHat: numfmt: invalid format ‘%.2f’, directive must be %['][-][N]f. Then it worked.
    – Vitaly
    Commented May 17 at 11:17
  • Thanks for informing! On my Mac, removing that period results in zero decimals. Interesting discrepancy...
    – ddelange
    Commented May 20 at 10:09

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .