简体   繁体   English

无法在本地私有注册表上推送 docker 镜像

[英]Unable to push docker image on local private registry

I'am struggling with this problem.我正在努力解决这个问题。 I have to push a docker image (which work rigthly with docker-compose up) to my local registry which was setup with the following command:我必须将 docker 映像(与 docker-compose up 一起正常工作)推送到我的本地注册表,该注册表是使用以下命令设置的:

docker run -d -p 5000:5000 --restart=always --name registry registry:2

This is the output of 'docker ps'这是'docker ps'的输出

5fe319f37d5c registry:latest "/entrypoint.sh /etc/" 41 hours ago Up About an hour 0.0.0.0:5000->5000/tcp registry

I follow the steps to push the image:我按照步骤推送图像:

docker-compose up --build docker tag gatewayapi_api localhost:5000/gatewayapi_api docker push localhost:5000/gatewayapi_api docker tag gatewayapi_api localhost:5000/gatewayapi_api docker-compose up --build docker tag gatewayapi_api localhost:5000/gatewayapi_api docker push localhost:5000/gatewayapi_api

but in every case I obtain但在每种情况下我都得到

file integrity checksum failed for "etc/default/cacerts

I try every solution (restart docker, clean image, restart registry)我尝试了所有解决方案(重新启动 docker、清理映像、重新启动注册表)

Thanks in advance.提前致谢。

In this GitHub issue people are sharing their findings how to fix that issue.这个GitHub 问题中,人们正在分享他们的发现如何解决该问题。

TL;DR:特尔;博士:

  • On docker for Mac you might need to increase docker VM memory in the app Preferences->Advanced->Memory在 Mac 的 docker 上,您可能需要在应用程序 Preferences->Advanced->Memory 中增加 docker VM 内存
  • If did not help then cleanup might do it (helped me): docker system prune -a如果没有帮助,那么清理可能会做到(帮助我): docker system prune -a

Does your registry work correctly with an official image?您的注册表与官方图像一起正常工作吗? Like this:像这样:

docker pull alpine
docker tag alpine localhost:5000/my-alpine
docker push localhost:5000/my-alpine

Faced the same problem in Ubuntu 20.04 with package docker.io.在 Ubuntu 20.04 中使用包 docker.io 遇到了同样的问题。 Would have error "file integrity checksum failed" when pushing image to my private docker registry.将图像推送到我的私有 docker 注册表时会出现错误“文件完整性校验和失败”。 In my case the problem was fixed by following this official fix from Docker web site:在我的情况下,问题是通过遵循 Docker 网站的官方修复来解决的:

https://docs.docker.com/engine/install/linux-postinstall/#your-kernel-does-not-support-cgroup-swap-limit-capabilities https://docs.docker.com/engine/install/linux-postinstall/#your-kernel-does-not-support-cgroup-swap-limit-capabilities

Note that my Docker private registry was running as a container as above:请注意,我的 Docker 私有注册表作为容器运行,如上所示:

docker run -d -p 5000:5000 --restart=always --name registry registry:2 docker run -d -p 5000:5000 --restart=always --name registry registry:2

I was building and pushing Docker images from the same Docker engine on the same Ubuntu 20.04 computer, communicating through the socket (not the ethernet).我正在同一台 Ubuntu 20.04 计算机上从同一个 Docker 引擎构建和推送 Docker 映像,通过套接字(而不是以太网)进行通信。

I don't know if the problem was from the Docker client building the image or from the Docker private registry receiving the image, which was itself running as a container.我不知道问题是来自构建镜像的 Docker 客户端还是来自接收镜像的 Docker 私有注册表,它本身作为容器运行。 In any case, following the above official fix was the only thing I needed to get the problem resolved, I changed nothing else.无论如何,按照上述官方修复是我唯一需要解决的问题,我没有改变其他任何东西。

  1. Log into the Ubuntu or Debian host as a user with sudo privileges.以具有 sudo 权限的用户身份登录 Ubuntu 或 Debian 主机。

  2. Edit the /etc/default/grub file.编辑 /etc/default/grub 文件。 Add or edit the GRUB_CMDLINE_LINUX line to add the following two key-value pairs:添加或编辑 GRUB_CMDLINE_LINUX 行以添加以下两个键值对:

GRUB_CMDLINE_LINUX="cgroup_enable=memory swapaccount=1" GRUB_CMDLINE_LINUX="cgroup_enable=内存交换账户=1"

  1. Update GRUB.更新 GRUB。 If your GRUB configuration file has incorrect syntax, an error occurs.如果您的 GRUB 配置文件的语法不正确,则会发生错误。 In this case, repeat steps 2 and 3.在这种情况下,重复步骤 2 和 3。

$ sudo update-grub $ 须藤更新-grub

  1. The changes take effect when the system is rebooted.更改在系统重新启动时生效。

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

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