Docker image size

I am pulling a Docker image about 0.5 GB in size on the Docker Hub. Pulling it onto my Centos machine, the image size became 1.6 GB. Clicking the image with the new name shows 2 GB on the Docker hub. How to get the same size image on a Docker hub?

+6
source share
2 answers

A similar issue was posted in question 14204 , for docker 1.7.0 on Ubuntu.
(And by default, CentOS may not have the latest version of the docker, so the first step is to update if possible)

Questions to check:

  • How did you install docker?
  • Can you provide a list of steps to reproduce the problem?
  • sudo du -sh/var/lib/docker/*
  • devicemapper , aufs?

, , /etc/default/docker

# Use DOCKER_OPTS to modify the daemon startup options.
DOCKER_OPTS="--storage-driver=devicemapper"

OP Dragomir Adrian , : 1.9.1 .

+1

, , .

TLDR; : schnatterer/docker-image-size.

:

DockerHub debian:stretch-20190204-slim DockerHub:

Screenshot DockerHub

quay.io Repos .

jq.

export DOCKER_CLI_EXPERIMENTAL=enabled

echo $(( ( $(docker manifest inspect -v docker.io/debian:stretch-20190204-slim \
              | jq '.[] | select(.Descriptor.platform.architecture == "amd64").SchemaV2Manifest.layers[0].size') \
           + 500000) \
         / 1000 \
         / 1000)) MB
23 MB

:

  • export DOCKER_CLI_EXPERIMENTAL=enabled - docker manifest ( 18.06.1-). ~/.docker/config.json - . |
  • docker manifest inspect -v docker.io/debian:stretch-20190204-slim - -
  • jq '.[] | select(.Descriptor.platform.architecture == "amd64").SchemaV2Manifest.layers[0].size - ( )
  • + 500000 -
  • /1000 - /

reg jq.

echo $(( ( $(reg manifest debian:stretch-20190204-slim |  \
            jq '.layers[].size' \
            | paste -sd+ | bc) \
           + 500000) \
         / 1000 \
         / 1000)) MB
23 MB

:

  • reg manifest debian:stretch-20190204-slim - -
  • jq '.layers[].size' - ( )
  • paste -sd+ | bc - ( )
  • + 500000 -
  • /1000 - /

reg docker manifest . , , curl . , OTOH, - ( ).

echo $(( ( $(curl -s https://gcr.io/v2/distroless/java/manifests/11-debug |  \
            jq '.layers[].size' \
            | paste -sd+ | bc) \
           + 500000) \
         / 1000 \
         / 1000)) MB
69 MB

:

+1

Source: https://habr.com/ru/post/1618756/


All Articles