6

It's my first Docker image, I put there my own bash script. This script uses the whois command. After docker runs my script, I have some errors. Probably I made mistake on my dockerfile. Script works well on my ubuntu. Should I add the /etc/services file to my image?

Dockerfile:

FROM ubuntu
ADD ./ip_info /usr/src/ip_info
ADD ./ip_info /bin/ip_info
RUN apt-get update &&  apt-get -y install whois
RUN chmod +x /usr/src/ip_info
CMD ["/usr/src/ip_info"]

error:

getaddrinfo(whois.ripe.net): Servname not supported for ai_socktype
Benjamin W.
  • 46,058
  • 19
  • 106
  • 116
Radek K
  • 159
  • 5

1 Answers1

8

I fixed it by

RUN apt-get update && apt-get install -y --no-install-recommends ntp

to dockerfile.

Benjamin W.
  • 46,058
  • 19
  • 106
  • 116
Radek K
  • 159
  • 5
  • 4
    `RUN apt-get update && apt-get install -y --no-install-recommends netbase` is enough. That package contains the needed files /etc/protocols and /etc/services. The ntp package works because it depends on netbase. – jandd Dec 21 '20 at 15:31