Home > Enterprise >  docker-compose push incorrect image size
docker-compose push incorrect image size

Time:10-29

I've used docker-compose push for years now with no issues, till today. I'm confused by this one. Basically it looks like it's only pushing the local changes in my Dockerfile, but not the entire image based on my Dockerfile and the original source image.

$ docker-compose build
...
...
Successfully tagged registry.gitlab.com/<path_obfuscated>:21.10.02

$ docker images
REPOSITORY                                                         TAG              IMAGE ID       CREATED          SIZE
...
registry.gitlab.com/<obfuscated-path--------------------------->   21.10.02         3c8d770f0649   23 minutes ago   1.2GB
...

So you can see the image is 1.2 GB. Now I run: docker-compose push

It happens superfast, and when I look at the image on my registry, it's only 388 MB, instead of the expected 1.2 GB.

Does someone know why this is happening? I've been using the same method for years now, and this is the first that I ran into this issue.

Some extra bits:

$ docker version
Client:
 Version:           20.10.8
 API version:       1.41
 Go version:        go1.16.6
 Git commit:        3967b7d28e
 Built:             Wed Aug  4 21:24:10 2021
 OS/Arch:           linux/amd64
 Context:           default
 Experimental:      true

Server:
 Engine:
  Version:          20.10.8
  API version:      1.41 (minimum version 1.12)
  Go version:       go1.16.6
  Git commit:       75249d8
  Built:            Wed Aug  4 21:26:30 2021
  OS/Arch:          linux/amd64
  Experimental:     false
 containerd:
  Version:          v1.4.9
  GitCommit:        e25210fe30a0a703442421b0f60afac609f950a3
 runc:
  Version:          1.0.1
  GitCommit:        
 docker-init:
  Version:          0.19.0
  GitCommit:        de40ad0

$ docker-compose --version
docker-compose version 1.25.5, build unknown

CodePudding user response:

According to this issue in Docker GitHub:

docker images shows the uncompressed size. During a docker push, the engine compresses (gzip) the image before sending to the registry. The size shown in the Hub UI is the compressed size, and roughly represents how much work a fresh docker pull would need to do. The network transfer size is probably the more important number when deploying containers.

  • Related