简体   繁体   English

从 Dockerfile 构建 Docker 图像时出现问题

[英]Problem with building Docker image from Dockerfile

my task is to create a docker container from my own Dockerfile using ubuntu:18.10 and run pdflatex in this container.我的任务是使用 ubuntu:18.10 从我自己的 Dockerfile 创建一个 docker 容器并在此容器中运行 pdflatex。 My system is MacOs, my Dockerfile looks like this:我的系统是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"]

I input this line in Terminal, while being in the directory, where the Dockerfile is:我在终端中输入这一行,同时在目录中,其中 Dockerfile 是:

docker build .

The output I get is this:我得到的 output 是这样的:

[+] 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

As I understand it there is a problem while installing packs for pdflatex, but I don't understand what the error is and how to fix it.据我了解,在为 pdflatex 安装包时出现问题,但我不明白错误是什么以及如何修复它。 Can you tell me what to do?你能告诉我该怎么做吗?

Default repositories are deprecated.默认存储库已弃用。

Replace repositories *.ubuntu.com with old-releases.ubuntu.com in /etc/apt/sources.list with following (This is entire Dockerfile): Replace repositories *.ubuntu.com with old-releases.ubuntu.com in /etc/apt/sources.list with following (This is entire 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"]

Note that I added -y to the apt-get install command because I want to automatically agree to the installation.请注意,我在apt-get install命令中添加了-y ,因为我想自动同意安装。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM