E
E
Egor Zhivagin2017-10-26 15:30:05
linux
Egor Zhivagin, 2017-10-26 15:30:05

Through Docker, apt-get gives errors, why?

Ubuntu 16.04
I started to get acquainted with Docker, I make the first Dockerfile (commands in RUN work fine if you just type it into the console) -

FROM docker/whalesay:latest
RUN apt-get -y update && apt-get install -y fortunes
CMD /usr/games/fortune -a | cowsay

Then docker build -t and in the process of executing the step with apt-get, errors like this fly:
Failed to fetch 1
E: Failed to fetch http://archive.ubuntu.com/ubuntu/pool/main/r/recode/librecode0_3.6-21_amd64.deb
  Temporary failure resolving 'archive.ubuntu.com'
Temporary failure resolving
Err http://archive.ubuntu.com/ubuntu/ trusty/main librecode0 amd64 3.6-21
  Temporary failure resolving 'archive.ubuntu.com'
Err http://archive.ubuntu.com/ubuntu/ trusty/universe fortune-mod amd64 1:1.99.1-7
  Temporary failure resolving 'archive.ubuntu.com'
Err http://archive.ubuntu.com/ubuntu/ trusty/universe fortunes-min all 1:1.99.1-7
  Temporary failure resolving 'archive.ubuntu.com'
Failed to fetch 2
W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/trusty/InRelease

According to the phrase "Temporary failure resolving", Google suggests that the problem may be with dns servers. In the /etc/resolv.conf
file only
#Пингуется отлично
nameserver 127.0.1.1

Got into /etc/default/docker , uncommented the line with dns ports, now it looks like this:
DOCKER_OPTS="--dns 8.8.8.8 --dns 8.8.4.4 --ip-masq=true"

Did not help. Actually, these are all the solutions that I googled. It's embarrassing that the addresses of the packages with errors contain Trusty (ubuntu 14.04) ... Not under docker-a, these commands work fine. I spent half a day, tell me something, please

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
mureevms, 2017-10-26
@Krasnodar_etc

You took the old, like ... but mammoth base image. Here is the Dockerfile:

FROM ubuntu:16.04
RUN apt update && apt install fortunes cowsay -y
CMD ["/usr/games/fortune", "-e"]

-e, because I don't know how to push the pipe into CMD.
UPDATE
Like this:
CMD ["/bin/bash", "-c", "/usr/games/fortune -a | /usr/games/cowsay"]

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question