'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. My system is MacOs, my Dockerfile looks like this:

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:

docker build .

The output I get is this:

[+] 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. Can you tell me what to do?



Solution 1:[1]

Default repositories are deprecated.

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.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Martin Osusky