gpt4 book ai didi

macos - 从 Dockerfile 构建 Docker 镜像的问题

转载 作者:行者123 更新时间:2023-12-04 18:27:43 25 4
gpt4 key购买 nike

我的任务是使用 ubuntu:18.10 从我自己的 Dockerfile 创建一个 docker 容器,并在这个容器中运行 pdflatex。我的系统是 MacOs,我的 Dockerfile 是这样的:

FROM ubuntu:18.10

RUN apt-get update && apt-get install texlive-fonts-recommended \
texlive-generic-recommended \
texlive-latex-extra \
texlive-fonts-extra \
dvipng \
texlive-latex-recommended \
texlive-base \
texlive-pictures \
texlive-lang-cyrillic \
texlive-science \
cm-super \
texlive-generic-extra

CMD ["bash"]
我在终端中输入这一行,同时位于 Dockerfile 所在的目录中:
docker build .
我得到的输出是这样的:
[+] Building 1.7s (5/5) FINISHED                                                
=> [internal] load build definition from Dockerfile 0.0s
=> => transferring dockerfile: 455B 0.0s
=> [internal] load .dockerignore 0.0s
=> => transferring context: 2B 0.0s
=> [internal] load metadata for docker.io/library/ubuntu:18.10 0.0s
=> CACHED [1/2] FROM docker.io/library/ubuntu:18.10 0.0s
=> ERROR [2/2] RUN apt-get update && apt-get install texlive-fonts-recom 1.6s
------
> [2/2] RUN apt-get update && apt-get install texlive-fonts-recommended texlive-generic-recommended texlive-latex-extra texlive-fonts-extra dvipng texlive-latex-recommended texlive-base texlive-pictures texlive-lang-cyrillic texlive-science cm-super texlive-generic-extra:
#5 1.239 Ign:1 http://archive.ubuntu.com/ubuntu cosmic InRelease
#5 1.291 Ign:2 http://archive.ubuntu.com/ubuntu cosmic-updates InRelease
#5 1.343 Ign:3 http://archive.ubuntu.com/ubuntu cosmic-backports InRelease
#5 1.366 Ign:4 http://security.ubuntu.com/ubuntu cosmic-security InRelease
#5 1.394 Err:5 http://archive.ubuntu.com/ubuntu cosmic Release
#5 1.394 404 Not Found [IP: 91.189.88.142 80]
#5 1.447 Err:6 http://archive.ubuntu.com/ubuntu cosmic-updates Release
#5 1.447 404 Not Found [IP: 91.189.88.142 80]
#5 1.482 Err:7 http://security.ubuntu.com/ubuntu cosmic-security Release
#5 1.482 404 Not Found [IP: 91.189.91.39 80]
#5 1.497 Err:8 http://archive.ubuntu.com/ubuntu cosmic-backports Release
#5 1.498 404 Not Found [IP: 91.189.88.142 80]
#5 1.507 Reading package lists...
#5 1.537 E: The repository 'http://archive.ubuntu.com/ubuntu cosmic Release' does not have a Release file.
#5 1.538 E: The repository 'http://archive.ubuntu.com/ubuntu cosmic-updates Release' does not have a Release file.
#5 1.539 E: The repository 'http://security.ubuntu.com/ubuntu cosmic-security Release' does not have a Release file.
#5 1.540 E: The repository 'http://archive.ubuntu.com/ubuntu cosmic-backports Release' does not have a Release file.
------
executor failed running [/bin/sh -c apt-get update && apt-get install texlive-fonts-recommended texlive-generic-recommended texlive-latex-extra texlive-fonts-extra dvipng texlive-latex-recommended texlive-base texlive-pictures texlive-lang-cyrillic texlive-science cm-super texlive-generic-extra]: exit code: 100
据我了解,为 pdflatex 安装包时出现问题,但我不明白错误是什么以及如何修复它。你能告诉我该怎么做吗?

最佳答案

默认存储库已弃用。
将/etc/apt/sources.list 中的存储库 *.ubuntu.com 替换为 old-releases.ubuntu.com,如下所示(这是整个 Dockerfile):

FROM ubuntu:18.10

RUN sed -i 's/archive.ubuntu.com/old-releases.ubuntu.com/g' /etc/apt/sources.list
RUN sed -i 's/security.ubuntu.com/old-releases.ubuntu.com/g' /etc/apt/sources.list

RUN apt-get update && apt-get install -y texlive-fonts-recommended \
texlive-generic-recommended \
texlive-latex-extra \
texlive-fonts-extra \
dvipng \
texlive-latex-recommended \
texlive-base \
texlive-pictures \
texlive-lang-cyrillic \
texlive-science \
cm-super \
texlive-generic-extra

CMD ["bash"]
请注意,我添加了 -yapt-get install命令,因为我想自动同意安装。

关于macos - 从 Dockerfile 构建 Docker 镜像的问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/66400498/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com