Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

Error when building docker image

未关闭
#956 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

评估

难度
4/5
预计耗时
3-5 天
新手友好度
25/100
Issue 类型
缺陷
描述清晰度
需要澄清
活跃度
停滞
技术栈
docker, ruby

调研方向

先阅读 Makefile 中的目标 image 和 image_alpine,然后检查 Dockerfile 和 Dockerfile.alpine 中包安装命令附近的内容。重新执行两次构建,并确定报告的仓库连接失败是环境问题,还是需要修改项目。两 个 image 目标都能在没有包安装错误的情况下成功构建,即表示完成。

由索引模型根据 Issue 内容生成。

描述

When trying to build a Docker image, I got the following error:

$ make image
docker build -t gh-pages .
[+] Building 40.5s (6/15)                                        docker:default
 => [internal] load build definition from Dockerfile                       0.0s
 => => transferring dockerfile: 799B                                       0.0s
 => [internal] load metadata for docker.io/library/ruby:3.3                2.7s
 => [internal] load .dockerignore                                          0.0s
 => => transferring context: 108B                                          0.0s
 => CACHED [ 1/11] FROM docker.io/library/ruby:3.3@sha256:6fd8d27b52e3008  0.0s
 => [internal] load build context                                          0.0s
 => => transferring context: 5.94kB                                        0.0s
 => ERROR [ 2/11] RUN apt-get update   && apt-get install -y     git      37.7s
------                                                                          
 > [ 2/11] RUN apt-get update   && apt-get install -y     git     locales     make     nodejs:                                                                  
30.64 Ign:1 http://deb.debian.org/debian bookworm InRelease                     
30.64 Ign:2 http://deb.debian.org/debian bookworm-updates InRelease             
30.64 Ign:3 http://deb.debian.org/debian-security bookworm-security InRelease   
31.64 Ign:1 http://deb.debian.org/debian bookworm InRelease
31.64 Ign:2 http://deb.debian.org/debian bookworm-updates InRelease
31.64 Ign:3 http://deb.debian.org/debian-security bookworm-security InRelease
33.64 Ign:1 http://deb.debian.org/debian bookworm InRelease
33.64 Ign:2 http://deb.debian.org/debian bookworm-updates InRelease
33.64 Ign:3 http://deb.debian.org/debian-security bookworm-security InRelease
37.64 Err:1 http://deb.debian.org/debian bookworm InRelease
37.64   Could not connect to debian.map.fastlydns.net:80 (151.101.90.132), connection timed out Unable to connect to deb.debian.org:http:
37.64 Err:2 http://deb.debian.org/debian bookworm-updates InRelease
37.64   Unable to connect to deb.debian.org:http:
37.64 Err:3 http://deb.debian.org/debian-security bookworm-security InRelease
37.64   Unable to connect to deb.debian.org:http:
37.65 Reading package lists...
37.67 W: Failed to fetch http://deb.debian.org/debian/dists/bookworm/InRelease  Could not connect to debian.map.fastlydns.net:80 (151.101.90.132), connection timed out Unable to connect to deb.debian.org:http:
37.67 W: Failed to fetch http://deb.debian.org/debian/dists/bookworm-updates/InRelease  Unable to connect to deb.debian.org:http:
37.67 W: Failed to fetch http://deb.debian.org/debian-security/dists/bookworm-security/InRelease  Unable to connect to deb.debian.org:http:
37.67 W: Some index files failed to download. They have been ignored, or old ones used instead.
37.69 Reading package lists...
37.71 Building dependency tree...
37.71 Reading state information...
37.71 Package locales is not available, but is referred to by another package.
37.71 This may mean that the package is missing, has been obsoleted, or
37.71 is only available from another source
37.71 
37.71 E: Package 'locales' has no installation candidate
37.71 E: Unable to locate package nodejs
------

 3 warnings found (use docker --debug to expand):
 - LegacyKeyValueFormat: "ENV key=value" should be used instead of legacy "ENV key value" format (line 29)
 - LegacyKeyValueFormat: "ENV key=value" should be used instead of legacy "ENV key value" format (line 27)
 - LegacyKeyValueFormat: "ENV key=value" should be used instead of legacy "ENV key value" format (line 28)
Dockerfile:4
--------------------
   3 |     
   4 | >>> RUN apt-get update \
   5 | >>>   && apt-get install -y \
   6 | >>>     git \
   7 | >>>     locales \
   8 | >>>     make \
   9 | >>>     nodejs
  10 |     
--------------------
ERROR: failed to build: failed to solve: process "/bin/sh -c apt-get update   && apt-get install -y     git     locales     make     nodejs" did not complete successfully: exit code: 100
make: *** [Makefile:7: image] Error 1

For make image_alpine, the following error occurs

$ make image_alpine 
docker build -t gh-pages . -f Dockerfile.alpine
[+] Building 120.6s (6/9)                                        docker:default
 => [internal] load build definition from Dockerfile.alpine                0.0s
 => => transferring dockerfile: 613B                                       0.0s
 => WARN: LegacyKeyValueFormat: "ENV key=value" should be used instead of  0.0s
 => WARN: LegacyKeyValueFormat: "ENV key=value" should be used instead of  0.0s
 => WARN: LegacyKeyValueFormat: "ENV key=value" should be used instead of  0.0s
 => [internal] load metadata for docker.io/library/ruby:3.3-alpine         0.0s
 => [internal] load .dockerignore                                          0.0s
 => => transferring context: 108B                                          0.0s
 => [internal] load build context                                          0.1s
 => => transferring context: 1.91MB                                        0.1s
 => CACHED [1/5] FROM docker.io/library/ruby:3.3-alpine                    0.0s
 => ERROR [2/5] RUN apk update && apk add --no-cache   git               120.5s
------                                                                          
 > [2/5] RUN apk update && apk add --no-cache   git:                            
0.245 fetch https://dl-cdn.alpinelinux.org/alpine/v3.22/main/x86_64/APKINDEX.tar.gz                                                                             
60.34 WARNING: updating and opening https://dl-cdn.alpinelinux.org/alpine/v3.22/main: Permission denied                                                         
60.34 fetch https://dl-cdn.alpinelinux.org/alpine/v3.22/community/x86_64/APKINDEX.tar.gz
120.5 4 unavailable, 0 stale; 21 distinct packages available
120.5 WARNING: updating and opening https://dl-cdn.alpinelinux.org/alpine/v3.22/community: Permission denied
------

 3 warnings found (use docker --debug to expand):
 - LegacyKeyValueFormat: "ENV key=value" should be used instead of legacy "ENV key value" format (line 16)
 - LegacyKeyValueFormat: "ENV key=value" should be used instead of legacy "ENV key value" format (line 17)
 - LegacyKeyValueFormat: "ENV key=value" should be used instead of legacy "ENV key value" format (line 18)
Dockerfile.alpine:3
--------------------
   2 |     
   3 | >>> RUN apk update && apk add --no-cache \
   4 | >>>   git
   5 |     
--------------------
ERROR: failed to build: failed to solve: process "/bin/sh -c apk update && apk add --no-cache   git" did not complete successfully: exit code: 4
make: *** [Makefile:9: image_alpine] Error 1
主要语言
Ruby
星标
1.9k
派生
361
PR 合并指标
30 天内没有已合并 PR

环境准备

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

github/pages-gem 的其他 Issue

查看 github/pages-gem 的全部 Issue

相似的 Issue

更多 Ruby Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。