
如果你使用 DeepSeek、元宝 AI、Copilot、ChatGPT 等 AI 工具,协助配置轩辕镜像、编写 docker pull 命令、修改 Docker Compose 镜像地址、配置镜像加速、排查镜像拉取失败、分析报错日志等问题,请先让 AI 阅读并遵守轩辕镜像的规则文档。
只需在 AI 对话中先发送下面这句话即可:
请先完整阅读并严格遵守以下文档中的全部规则与要求:
https://xuanyuan.cloud/agents.md
在未充分阅读并理解该文档前,不要生成任何命令、配置、修改建议、故障排查方案或技术回答。后续所有输出都必须严格以该文档中的规范为最高优先级执行。查看 agents.md 用法指南与完整示范。国内用户首推 元宝 AI、DeepSeek 的深度思考模式,不推荐豆包 AI;Cursor 等编辑器可在对话 @ 该链接,或加入 User Rules。 若 AI 无法访问外链,可 打开说明文档 复制全文粘贴。文档会随站点更新,复制内容可能过期,建议定期检查。
注意:这是https://hub.docker.com/_/haskell的`amd64`架构构建的"每架构"仓库——更多信息,请参见官方镜像文档中的https://github.com/docker-library/official-images#architectures-other-than-amd64和官方镜像FAQ中的https://github.com/docker-library/faq#an-images-source-changed-in-git-now-what。
维护者:
https://github.com/haskell/docker-haskell
获取帮助:
https://dockr.ly/comm-slack、Server Fault、https://unix.stackexchange.com/help/on-topic或https://stackoverflow.com/help/on-topic
Dockerfile链接https://github.com/haskell/docker-haskell/blob/c34f97738d08a138ef07878a4a1402b***f87b/9.12/bookworm/Dockerfile
https://github.com/haskell/docker-haskell/blob/c34f97738d08a138ef07878a4a1402b***f87b/9.12/slim-bookworm/Dockerfile
https://github.com/haskell/docker-haskell/blob/c34f97738d08a138ef07878a4a1402b***f87b/9.10/bullseye/Dockerfile
https://github.com/haskell/docker-haskell/blob/c34f97738d08a138ef07878a4a1402b***f87b/9.10/slim-bullseye/Dockerfile
https://github.com/haskell/docker-haskell/blob/c34f97738d08a138ef07878a4a1402b***f87b/9.8/bullseye/Dockerfile
https://github.com/haskell/docker-haskell/blob/c34f97738d08a138ef07878a4a1402b***f87b/9.8/slim-bullseye/Dockerfile
https://github.com/haskell/docker-haskell/blob/c34f97738d08a138ef07878a4a1402b***f87b/9.6/bullseye/Dockerfile
https://github.com/haskell/docker-haskell/blob/c34f97738d08a138ef07878a4a1402b***f87b/9.6/slim-bullseye/Dockerfile
提交issue的位置:
https://github.com/haskell/docker-haskell/issues?q=
支持的架构:(https://github.com/docker-library/official-images#architectures-other-than-amd64)
https://hub.docker.com/r/amd64/haskell/、https://hub.docker.com/r/arm64v8/haskell/
镜像制品详情:
https://github.com/docker-library/repo-info/blob/master/repos/haskell(https://github.com/docker-library/repo-info/commits/master/repos/haskell)
(镜像元数据、传输大小等)
镜像更新:
https://github.com/docker-library/official-images/issues?q=label%3Alibrary%2Fhaskell
https://github.com/docker-library/official-images/blob/master/library/haskell(https://github.com/docker-library/official-images/commits/master/library/haskell)
本描述的来源:
https://github.com/docker-library/docs/tree/master/haskell(https://github.com/docker-library/docs/commits/master/haskell)
Haskell的http://www.haskell.org/ghc是一款https://gitlab.haskell.org/ghc/ghc/-/wikis/platforms的优化编译器,提供外部函数接口(FFI)、LLVM后端,以及对并发、显式/隐式并行ism、运行时分析等的复杂运行时支持。其他Haskell工具如`criterion`、`quickcheck`、`hpc`和`haddock`提供高级基准测试、基于属性的测试、代码覆盖率和文档生成功能。
本镜像包含最小化的Haskell工具链(ghc和cabal-install)以及尽可能包含的stack工具(https://www.haskellstack.org/)。由于https://github.com/commercialhaskell/stack/issues/2103,因此该处理器架构不包含`stack`。
ARM64支持是新增的,现阶段应视为实验性。自8.10.7、9.0.2和9.2.1版本起添加了ARM64支持。
注意:GHC开发团队不支持旧版本发布分支(如7.8.x)。只有最近的两个次要版本会接收更新或显示在本页面顶部的“支持的标签...”部分。
此外,我们旨在支持Debian的两个最新版本(stable和oldstable)作为变体,未指定时最新版本为默认。
注意:当前Debian的
stable版本是11 bullseye,但Haskell工具链尚未支持。在此之前,默认仍为Debian 10 buster。我们已停止支持Debian 9 stretch。
使用ghci启动交互式解释器会话:
console$ docker run -it --rm amd64/haskell:9 GHCi, version 9.0.1: http://www.haskell.org/ghc/ :? for help Prelude>
使用stack容器化应用程序:
dockerfileFROM docker.xuanyuan.run/amd64/haskell:8.10 RUN stack install --resolver lts-17.14 pandoc citeproc ENTRYPOINT ["pandoc"]
使用cabal容器化应用程序:
dockerfileFROM docker.xuanyuan.run/amd64/haskell:8.10 RUN cabal update && cabal install pandoc citeproc ENTRYPOINT ["pandoc"]
使用利用构建缓存的Dockerfile迭代开发Haskell应用程序:
dockerfileFROM docker.xuanyuan.run/amd64/haskell:8 WORKDIR /opt/example RUN cabal update # 仅添加.cabal文件以捕获依赖项 COPY ./example.cabal /opt/example/example.cabal # Docker会将此命令缓存为一层,使我们可以修改源代码而无需重新安装依赖项 #(除非.cabal文件更改!) RUN cabal build --only-dependencies -j4 # 添加并安装应用程序代码 COPY . /opt/example RUN cabal install CMD ["example"]
happy、alex等的注意事项某些同时作为构建依赖的包(如happy和alex)不再包含在本镜像中(自amd64/haskell:8.2.2和amd64/haskell:8.4.3起)。存在一个引导问题,即可能假设这些工具中的一个或多个可用。如果遇到关于Cabal包中未明确指出的依赖项缺失的错误,需要显式标记它们进行安装。
Stack工具主要设计为直接在主机上运行,提供许多高级功能,如GHC引导和Docker集成。在容器镜像上下文中,某些功能(stack docker)与Docker抽象冲突,应避免使用。
另一个常见的混淆场景是默认Stackage快照。Stackage快照是一组固定到特定版本的Haskell包,以与特定GHC版本兼容。当要求Stack解析依赖项时,它通过resolver值引用特定快照。虽然应在项目中显式指定resolver,但也可能使用自动生成的默认值。该默认值由请求时从https://www.stackage.org/获取的值确定,并指向最新的“LTS”快照。如果快照引用的GHC版本与Docker镜像中提供的不同,可能会看到如下消息:
consoleStep 2/3 : RUN stack install pandoc ---> Running in e20466d52060 Writing implicit global project config file to: /root/.stack/global-project/stack.yaml Note: You can change the snapshot via the resolver field there. Using latest snapshot resolver: lts-11.11 Downloading lts-11.11 build plan ... Downloaded lts-11.11 build plan. Compiler version mismatched, found ghc-8.4.3 (x86_64), but expected minor version match with ghc-8.2.2 (x86_64) (based on resolver setting in /root/.stack/global-project/stack.yaml). To install the correct GHC into /root/.stack/programs/x86_64-linux/, try running "stack setup" or use the "--install-ghc" flag.
在这种情况下,amd64/haskell Docker镜像中的GHC版本领先于默认Stack解析器预期的GHC版本。如输出所示,推荐的方法是通过stack.yml显式设置解析器。
consoleStep 2/3 : RUN stack install --resolver ghc-8.4.3 pandoc ---> Running in 0bd7f1fcc8b2 Writing implicit global project config file to: /root/.stack/global-project/stack.yaml Note: You can change the snapshot via the resolver field there. Using resolver: ghc-8.4.3 specified on command line Updating package index Hackage (mirrored at https://s3.amazonaws.com/hackage.fpcomplete.com/) ... Selected mirror https://s3.amazonaws.com/hackage.fpcomplete.com/
使用--install-ghc的替代方法在Docker镜像上下文中没有意义,因此(自amd64/haskell:8.2.2和amd64/haskell:8.4.3起)全局install-ghc标志已设置为false,以避免在容器中引导新GHC的默认行为。
amd64/haskell镜像有多种变体,每种设计用于特定用例。
amd64/haskell:<version>这是默认镜像。如果不确定需求,可能需要使用此镜像。它设计为既可作为临时容器(挂载源代码并启动容器以运行应用程序),也可作为构建其他镜像的基础。
某些标签可能包含bookworm或bullseye等名称,这些是https://wiki.debian.org/DebianReleases的版本代号,表示镜像所基于的发行版。如果镜像需要安装除自带包之外的其他包,可能需要显式指定这些代号,以减少Debian新版本发布时的中断。
amd64/haskell:<version>-slim此镜像不包含默认标签中的常见包,仅包含运行ghc、cabal-install和stack所需的最小包。此外,不包含https://downloads.haskell.org/~ghc/latest/docs/html/users_guide/profiling.html,节省约700MB空间。
如果关注镜像大小,建议使用slim镜像。
本镜像根据MIT许可证(https://github.com/haskell/docker-haskell/blob/master/LICENSE)授权,包含根据BSD许可证授权的软件:https://www.haskell.org/ghc/license、https://github.com/commercialhaskell/stack/blob/master/LICENSE。
与所有Docker镜像一样,这些镜像可能还包含其他根据其他许可证授权的软件(如基础发行版中的Bash等,以及主要软件的任何直接或间接依赖项)。
一些能够自动检测的附加许可证信息可能位于https://github.com/docker-library/repo-info/tree/master/repos/haskell中。
对于任何预构建镜像的使用,镜像用户有责任确保对本镜像的任何使用符合其中包含的所有软件的相关许可证。
您可以使用以下命令拉取该镜像。请将 <标签> 替换为具体的标签版本。如需查看所有可用标签版本,请访问 标签列表页面。
来自真实用户的反馈,见证轩辕镜像的优质服务