注意:这是 https://hub.docker.com/_/golang 的 ppc64le 架构构建的“特定架构”仓库——更多信息,请参阅官方镜像文档中的“https://github.com/docker-library/official-images#architectures-other-than-amd64%E2%80%9D%E4%BB%A5%E5%8F%8A%E5%AE%98%E6%96%B9%E9%95%9C%E5%83%8FFAQ%E4%B8%AD%E7%9A%84%E2%80%9Chttps://github.com/docker-library/faq#an-images-source-changed-in-git-now-what%E2%80%9D%E3%80%82
维护者:
https://github.com/docker-library/golang
获取帮助的渠道:
Docker社区Slack、Server Fault、Unix & Linux 或 Stack Overflow
(参见FAQ中的“https://github.com/docker-library/faq#whats-the-difference-between-shared-and-simple-tags%E2%80%9D%EF%BC%89
https://github.com/docker-library/golang/blob/fca8040176e4e0c3d409c87d58fd8a81b16f2429/1.25/trixie/Dockerfile
https://github.com/docker-library/golang/blob/fca8040176e4e0c3d409c87d58fd8a81b16f2429/1.25/bookworm/Dockerfile
https://github.com/docker-library/golang/blob/fca8040176e4e0c3d409c87d58fd8a81b16f2429/1.25/alpine3.22/Dockerfile
https://github.com/docker-library/golang/blob/fca8040176e4e0c3d409c87d58fd8a81b16f2429/1.25/alpine3.21/Dockerfile
https://github.com/docker-library/golang/blob/411dd143e04f39d9664f81d5284d7dd55949dbde/1.24/trixie/Dockerfile
https://github.com/docker-library/golang/blob/411dd143e04f39d9664f81d5284d7dd55949dbde/1.24/bookworm/Dockerfile
https://github.com/docker-library/golang/blob/411dd143e04f39d9664f81d5284d7dd55949dbde/1.24/alpine3.22/Dockerfile
https://github.com/docker-library/golang/blob/411dd143e04f39d9664f81d5284d7dd55949dbde/1.24/alpine3.21/Dockerfile
https://github.com/docker-library/golang/blob/048aed45b0fab735c8157c9449d32a17ee88cf62/tip/trixie/Dockerfile
https://github.com/docker-library/golang/blob/048aed45b0fab735c8157c9449d32a17ee88cf62/tip/bookworm/Dockerfile
https://github.com/docker-library/golang/blob/048aed45b0fab735c8157c9449d32a17ee88cf62/tip/alpine3.22/Dockerfile
https://github.com/docker-library/golang/blob/048aed45b0fab735c8157c9449d32a17ee88cf62/tip/alpine3.21/Dockerfile
1.25.3, 1.25, 1, latest:
1.24.9, 1.24:
tip-20251011, tip:
问题反馈渠道:
https://github.com/docker-library/golang/issues?q=
支持的架构:(https://github.com/docker-library/official-images#architectures-other-than-amd64)
https://hub.docker.com/r/amd64/golang/%E3%80%81https://hub.docker.com/r/arm32v6/golang/%E3%80%81https://hub.docker.com/r/arm32v7/golang/%E3%80%81https://hub.docker.com/r/arm64v8/golang/%E3%80%81https://hub.docker.com/r/i386/golang/%E3%80%81https://hub.docker.com/r/mips64le/golang/%E3%80%81https://hub.docker.com/r/ppc64le/golang/%E3%80%81https://hub.docker.com/r/riscv64/golang/%E3%80%81https://hub.docker.com/r/s390x/golang/%E3%80%81https://hub.docker.com/r/winamd64/golang/
已发布镜像制品详情:
https://github.com/docker-library/repo-info/blob/master/repos/golang%EF%BC%88https://github.com/docker-library/repo-info/commits/master/repos/golang%EF%BC%89
(镜像元数据、传输大小等)
镜像更新:
https://github.com/docker-library/official-images/issues?q=label%3Alibrary%2Fgolang
https://github.com/docker-library/official-images/blob/master/library/golang%EF%BC%88https://github.com/docker-library/official-images/commits/master/library/golang%EF%BC%89
本描述的来源:
https://github.com/docker-library/docs/tree/master/golang%EF%BC%88https://github.com/docker-library/docs/commits/master/golang%EF%BC%89
Go(又称 Golang)是一种最初由 Google 开发的编程语言。它是一种静态类型语言,语法大致源自 C,但增加了垃圾回收、类型安全、一些动态类型功能、额外的内置类型(如变长数组和键值映射)以及大型标准库。
***.org/wiki/Go_(programming_language)
!https://raw.githubusercontent.com/docker-library/docs/01c***b2fe592c1f93a13b4e289ada0e3a1/golang/logo.png
注意:/go 目录是全局可写的,以允许灵活指定运行容器的用户(例如,在使用 --user 1000:1000 启动的容器中,将 go get github.com/example/... 运行到默认 $GOPATH 会成功)。虽然 777 权限的目录在常规主机设置中不安全,但容器内通常没有其他进程或用户,因此这相当于 Docker 使用场景下的 700 权限,但允许 --user 灵活配置。
使用此镜像最直接的方式是将 Go 容器同时用作构建和运行环境。在 Dockerfile 中,可以编写如下内容来编译和运行项目(假设项目使用 go.mod 进行依赖管理):
dockerfileFROM ppc64le/golang:1.25 WORKDIR /usr/src/app # 预先复制并缓存 go.mod 以预下载依赖,后续构建中仅在依赖更改时重新下载 COPY go.mod go.sum ./ RUN go mod download COPY . . RUN go build -v -o /usr/local/bin/app ./... CMD ["app"]
然后可以构建并运行 Docker 镜像:
console$ docker build -t my-golang-app . $ docker run -it --rm --name my-running-app my-golang-app
有时可能不适合在容器内运行应用。要在 Docker 实例内编译但不运行应用,可以执行类似以下命令:
console$ docker run --rm -v "$PWD":/usr/src/myapp -w /usr/src/myapp ppc64le/golang:1.25 go build -v
这会将当前目录作为卷挂载到容器,将工作目录设置为该卷,并运行 go build 命令,该命令会告诉 Go 编译工作目录中的项目,并将可执行文件输出到 myapp。或者,如果有 Makefile,可以在容器内运行 make 命令:
console$ docker run --rm -v "$PWD":/usr/src/myapp -w /usr/src/myapp ppc64le/golang:1.25 make
如果需要为非 linux/amd64 平台(如 windows/386)编译应用:
console$ docker run --rm -v "$PWD":/usr/src/myapp -w /usr/src/myapp -e GOOS=windows -e GOARCH=386 ppc64le/golang:1.25 go build -v
或者,可以一次为多个平台编译:
console$ docker run --rm -it -v "$PWD":/usr/src/myapp -w /usr/src/myapp ppc64le/golang:1.25 bash $ for GOOS in darwin linux; do > for GOARCH in 386 amd64; do > export GOOS GOARCH > go build -v -o myapp-$GOOS-$GOARCH > done > done
如果下载依赖时出现“校验和不匹配”等错误,应检查是否使用了 Git LFS(因此需要安装它来下载依赖并计算正确的 go.sum 值)。
ppc64le/golang 镜像有多种版本,每种版本适用于特定用例。
ppc64le/golang:<version>这是默认镜像。如果不确定需求,可能需要使用此版本。它设计为既可作为临时容器(挂载源代码并启动容器以运行应用),也可作为构建其他镜像的基础。
一些标签可能包含 bookworm 或 trixie 等名称,这些是 Debian 发行版的代号,表示镜像基于哪个发行版。如果镜像需要安装除自带软件包之外的其他软件包,可能需要显式指定这些代号以减少 Debian 新版本发布时的中断。
ppc64le/golang:<version>-alpine此镜像基于流行的 Alpine Linux 项目,可在 https://hub.docker.com/_/alpine 中获取。Alpine Linux 比大多数发行版基础镜像小得多(约 5MB),因此通常会生成更精简的镜像。
此变体高度实验性,且 未 得到 Go 项目的官方支持(详见 https://github.com/golang/go/issues/***%EF%BC%89%E3%80%82
需要注意的主要问题是它使用 musl libc 而非 glibc 及相关库,这可能导致意外行为。有关可能出现的问题以及使用 Alpine 基础镜像的优缺点比较,参见 此 Hacker News 评论线程。
为最小化镜像大小,Alpine 基础镜像不包含额外相关工具(如 git、gcc 或 bash)。以此镜像为基础时,需在自己的 Dockerfile 中添加所需工具(如果不熟悉如何安装软件包,参见 https://hub.docker.com/_/alpine/ 中的示例)。另参见 https://github.com/docker-library/golang/issues/250#issuecomment-451201761 了解更多解释。
ppc64le/golang:<version>-tipGo 社区中的“tip”一词指最新开发分支(https://github.com/golang/build/blob/6383021611af0e07cbf0a60222e066662557c796/cmd/coordinator/internal/legacydash/build.go#L313-L314%EF%BC%89%E3%80%82
这些标签包含 Go 最新开发分支的构建,约每周更新一次。
查看此镜像包含的软件的 许可证信息。
与所有 Docker 镜像一样,这些镜像可能还包含其他软件,这些软件可能采用其他许可证(如基础发行版中的 Bash 等,以及主要软件的任何直接或间接依赖项)。
一些能够自动检测到的额外许可证信息可能位于 https://github.com/docker-library/repo-info/tree/master/repos/golang 中。
对于任何预构建镜像的使用,镜像用户有责任确保对本镜像的任何使用符合其中包含的所有软件的相关许可证。
以下是 ppc64le/golang 相关的常用 Docker 镜像,适用于 不同场景 等不同场景:
您可以使用以下命令拉取该镜像。请将 <标签> 替换为具体的标签版本。如需查看所有可用标签版本,请访问 标签列表页面。


探索更多轩辕镜像的使用方法,找到最适合您系统的配置方式
通过 Docker 登录认证访问私有仓库
无需登录使用专属域名
Kubernetes 集群配置 Containerd
K3s 轻量级 Kubernetes 镜像加速
VS Code Dev Containers 配置
Podman 容器引擎配置
HPC 科学计算容器配置
ghcr、Quay、nvcr 等镜像仓库
Harbor Proxy Repository 对接专属域名
Portainer Registries 加速拉取
Nexus3 Docker Proxy 内网缓存
需要其他帮助?请查看我们的 常见问题Docker 镜像访问常见问题解答 或 提交工单
docker search 限制
站内搜不到镜像
离线 save/load
插件要用 plugin install
WSL 拉取慢
安全与 digest
新手拉取配置
镜像合规机制
manifest unknown
no matching manifest(架构)
invalid tar header(解压)
TLS 证书失败
DNS 超时
域名连通性排查
410 Gone 排查
402 与流量用尽
401 认证失败
429 限流
D-Bus 凭证提示
413 与超大单层
来自真实用户的反馈,见证轩辕镜像的优质服务