简体   繁体   English

docker-compose 推送不正确的图像大小

[英]docker-compose push incorrect image size

I've used docker-compose push for years now with no issues, till today.我多年来一直使用docker-compose push没有任何问题,直到今天。 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.基本上它看起来只是在我的 Dockerfile 中推送本地更改,而不是基于我的 Dockerfile 和原始源图像的整个图像。

$ 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 .所以你可以看到图像是1.2 GB Now I run: docker-compose push现在我运行: 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 .它发生得非常快,当我查看注册表上的图像时,它只有388 MB ,而不是预期的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

According to this issue in Docker GitHub:根据 Docker GitHub 中的这个问题

docker images shows the uncompressed size. docker images显示未压缩的大小。 During a docker push, the engine compresses (gzip) the image before sending to the registry.在 docker push 期间,引擎会在发送到注册表之前压缩 (gzip) 图像。 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. Hub UI 中显示的大小是压缩后的大小,大致表示新的docker pull需要做多少工作。 The network transfer size is probably the more important number when deploying containers.在部署容器时,网络传输大小可能是更重要的数字。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM