【问题标题】:Docker: Build fails with error unknown parent image IDDocker:构建失败并出现错误未知父映像 ID
【发布时间】:2020-06-24 06:32:30
【问题描述】:

我正面临间歇性构建作业失败并出现以下错误。

[0munknown parent image ID sha256:478c35b0xxxxxxxxxxxxxxx
Build step 'Execute shell' marked build as failure

【问题讨论】:

  • 考虑添加更多细节。你想做什么,你是怎么做到的?
  • 我在 Jenkins 上遇到了这个问题,这似乎是不确定的。我的命令只是docker build --rm --tag foo:bar .
  • 你能用命令 docker image ls 发送你看到的东西吗

标签: docker jenkins docker-compose dockerfile


【解决方案1】:

如果您有一个名称为 none 的图像,那么您需要删除它并重建您的容器。这就是为我解决它的原因。

【讨论】:

  • 代表 Craft 发表评论:你能用 docker image ls 发送你看到的内容吗?
  • 请仅在 cmets 中要求澄清。
  • 目前还不清楚为什么这行得通,但它确实为我解决了问题。谢谢!
【解决方案2】:

这一般发生在你同时清理 docker 内存时(或者有人同时删除 /var/lib/docker/image/overlay2/imagedb/content 的内容或者运行 docker system prune),所以你的镜像正在构建无法找到存在图像数据的父文件夹。 确保这不会同时发生并重新启动构建。

【讨论】:

    【解决方案3】:

    在构建 docker 映像时,我也有同样的担忧。我得到的错误信息如下:

    [Docker] ERROR: Failed to create docker image: Could not build image: unknown parent image ID sha256:cc0b3bd844b13a2ebfc6915019a8194538f2d0b41e420b76a20702e985e2a298
    ERROR: Build step failed with exception
    com.github.dockerjava.api.exception.DockerClientException: Could not build image: unknown parent image ID sha256:cc0b3bd844b13a2ebfc6915019a8194538f2d0b41e420b76a20702e985e2a298
    

    对我有用的只是尝试再次重建图像,并且效果很好。

    就是这样。

    我希望这会有所帮助

    【讨论】:

      【解决方案4】:

      在构建命令行中使用 --no-cache 标签。

      docker build --no-cache -t dockerimagenew:v1 .
      

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 2019-08-13
        • 2021-06-16
        • 1970-01-01
        • 2020-01-27
        • 2019-12-02
        • 1970-01-01
        • 2021-11-27
        相关资源
        最近更新 更多