# Problema de instalación: \`getaddrinfo: Nombre o servicio no conocido\`

**URL:** https://meta.discourse.org/t/install-problem-getaddrinfo-name-or-service-not-known/86783
**Category:** Support
**Created:** [4 Mayo, 2018 19:23 UTC](https://meta.discourse.org/t/install-problem-getaddrinfo-name-or-service-not-known/86783 "2018-05-04T19:23:52Z")
**Posts on this page:** 9
**Page:** 1

<div class="post-metadata">

### Author: ![pfaffman](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pfaffman/32/120154_2.png) [@pfaffman](https://meta.discourse.org/u/pfaffman)
#### Post date: [4 Mayo, 2018 19:23 UTC](https://meta.discourse.org/t/install-problem-getaddrinfo-name-or-service-not-known/86783/1 "2018-05-04T19:23:52Z")

</div>

I’ve got three new servers running Ubuntu 16.04 & apparently have some Docker problem. Though I suspect it’s a trivial and “obvious” Docker problem, I’ve searched more widely for answers, but have come up empty. I’d like to think that it’s some new Docker bug (and not something stupid that I’ve done), but clean installs on Digital Ocean work fine.

It seems that the container can’t download gems.

```
Docker version 18.04.0-ce, build 3d479c0

```

```plaintext
I, [2018-05-04T00:42:53.689239 #15] INFO -- : > echo "done configuring web"
I, [2018-05-04T00:42:53.690557 #15] INFO -- : done configuring web

I, [2018-05-04T00:42:53.690718 #15] INFO -- : > cd /var/www/discourse && gem update bundler
ERROR: While executing gem ... (SocketError)
    getaddrinfo: Name or service not known
I, [2018-05-04T00:42:53.829426 #15] INFO -- : Updating installed gems

I, [2018-05-04T00:42:53.829592 #15] INFO -- : Terminating async processes
I, [2018-05-04T00:42:53.829620 #15] INFO -- : Sending INT to HOME=/var/lib/postgresql USER=postgres exec

```

It looks like it can’t resolve something, but I’ve tried putting `DOCKER_OPTS="--dns 1.0.0.1 --dns 1.1.1.1"` in`/etc/default/docker` (as suggested [here](https://meta.discourse.org/t/initial-email-failure-job-exception-getaddrinfo-name-or-service-not-known/42301/2)) and no joy. Another container I can get in to and `ping google.com`. (That container is a VPN, which worked fine for a while and I can’t connect to now; I have no idea whether that’s related.)

I tried this (as suggested [here](https://meta.discourse.org/t/new-install-wont-bootstrap-gem-update-socket-error/24681/4)):

```plaintext
docker run -it --rm ubuntu bin/bash
apt upgrade
apt install iputils-ping
ping google.com 

```

and it works.

~~The host has several static IPs. Could docker not know how to bind to them to the right one? No. I changed to a single IP and that didn’t fix it.~~

```plaintext
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host 
       valid_lft forever preferred_lft forever
2: enp1s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
    link/ether 00:e0:4c:68:02:54 brd ff:ff:ff:ff:ff:ff
    inet 38.242.7.195/28 brd 38.242.7.207 scope global enp1s0
       valid_lft forever preferred_lft forever
    inet6 fe80::2e0:4cff:fe68:254/64 scope link 
       valid_lft forever preferred_lft forever
3: docker0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue state DOWN group default 
    link/ether 02:42:6f:3a:ac:26 brd ff:ff:ff:ff:ff:ff
    inet 172.17.0.1/16 brd 172.17.255.255 scope global docker0
       valid_lft forever preferred_lft forever
    inet6 fe80::42:6fff:fe3a:ac26/64 scope link 
       valid_lft forever preferred_lft forever
6: virbr0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue state DOWN group default qlen 1000
    link/ether 52:54:00:e3:f5:bd brd ff:ff:ff:ff:ff:ff
    inet 192.168.122.1/24 brd 192.168.122.255 scope global virbr0
       valid_lft forever preferred_lft forever
7: virbr0-nic: <BROADCAST,MULTICAST> mtu 1500 qdisc pfifo_fast master virbr0 state DOWN group default qlen 1000
    link/ether 52:54:00:e3:f5:bd brd ff:ff:ff:ff:ff:ff

```

---

<div class="post-metadata">

### Author: ![mpalmer](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/mpalmer/32/45740_2.png) [@mpalmer](https://meta.discourse.org/u/mpalmer)
#### Post date: [5 Mayo, 2018 01:06 UTC](https://meta.discourse.org/t/install-problem-getaddrinfo-name-or-service-not-known/86783/2 "2018-05-05T01:06:27Z")

</div>

Check if it’s a recently-introduced Docker bug by downgrading to 18.03. Can’t say it’s likely to fix it, but it’s easy enough to try it first just in case.

Modify the app.yml to run the ping test before anything else; that’ll rule in (or out) problems with the app container itself versus network issues.

After that, you’re in `tcpdump` territory. Capture DNS packets going over `docker0` with something like `tcpdump -i docker0 -n port 53`, and make sure the packets are at least getting onto the network. Then make sure they’re getting _out_ by capturing on `enp1s0` as well – and make sure they’re gooing out with the machine’s public IP, rather than some internal IP. If the firewall’s too restrictive, the packets won’t show up at all on one of those `tcpdump`s, and if they’re on `enp1s0` but with a private IP, then the NAT config’s busted.

If the packets are going out but not coming back, there’s upstream network problems (or an `OUTPUT` rule that’s eating them at the last minute), but given you’ve got some DNS resolution on the machine, the problem’s unlikely to be there. If the DNS response packets are coming back in part of the way, then it’s incoming firewall rules that are the problem, and if they appear to be making it all the way back to `docker0`, dump the `veth<whatever>` interface for the container to double-check, and if they’re there too, something’s setting up iptables rules inside the container, and you’re back to giving Docker some serious side-eye.

---

<div class="post-metadata">

### Author: ![pfaffman](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pfaffman/32/120154_2.png) [@pfaffman](https://meta.discourse.org/u/pfaffman)
#### Post date: [5 Mayo, 2018 01:50 UTC](https://meta.discourse.org/t/install-problem-getaddrinfo-name-or-service-not-known/86783/3 "2018-05-05T01:50:00Z")

</div>

Thanks, Matt. I am somewhat relieved that you didn’t say something like “Uh, duh, you just need to fix the permissions,” so I don’t look foolish. But, really, I’m disheartened that there’s not an obvious and quick solution.

I’m 90% sure that I did an install that worked when these machines were on my home network.

~~I guess I’ll dust off my `discourse-pin-docker` script and work down the list.~~ Well, that wasn’t it.

But, the `tcpdump` appears to have shed the necessary light! And now I see the typo in `/etc/network/interfaces` (perfectly replicated on all three servers) that was the root of the problem.

Hooray for simple (that I still don’t quite understand) networking errors!

And from there I found that I _do_ know how to get `pups` to bind to a single IP.

And soon, a few people can use a server that if it catches on fire will be down until I wake up and look at my phone.

Thanks, Matt. **My day is saved.**

 ![image](https://global.discourse-cdn.com/meta/original/3X/7/2/72eec2d493e020febc66224c69b5e61a437ab84d.png)

---

<div class="post-metadata">

### Author: ![codinghorror](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/codinghorror/32/110067_2.png) [@codinghorror](https://meta.discourse.org/u/codinghorror)
#### Post date: [5 Mayo, 2018 01:55 UTC](https://meta.discourse.org/t/install-problem-getaddrinfo-name-or-service-not-known/86783/4 "2018-05-05T01:55:49Z")

</div>

All this for.. a typo? How is this going to help any future readers?

---

<div class="post-metadata">

### Author: ![pfaffman](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pfaffman/32/120154_2.png) [@pfaffman](https://meta.discourse.org/u/pfaffman)
#### Post date: [5 Mayo, 2018 02:00 UTC](https://meta.discourse.org/t/install-problem-getaddrinfo-name-or-service-not-known/86783/5 "2018-05-05T02:00:50Z")

</div>

Yeah. A typo. I’m afraid my tale of woe is unlikely help future readers, **except** to know that you can use `tcpdump` to watch port 53. That was the saving grace.

The actual typo was somehow I copy-pasted `dns-nameservers` in twice, so I had

```plaintext
uto enp1s0
iface enp1s0 inet static
  address 38.242.7.195/28
  gateway 38.242.7.193
  dns-nameservers dns-nameservers 1.0.0.1 1.1.1.1

```

rather than

```plaintext
  dns-nameservers 1.0.0.1 1.1.1.1

```

And DNS worked all the time except, inside of docker. (Docker used only the first entry rather than using the next one if the first failed?)

---

<div class="post-metadata">

### Author: ![thsnyzkn](https://avatars.discourse-cdn.com/v4/letter/t/0ea827/32.png) [@thsnyzkn](https://meta.discourse.org/u/thsnyzkn)
#### Post date: [3 Julio, 2019 15:47 UTC](https://meta.discourse.org/t/install-problem-getaddrinfo-name-or-service-not-known/86783/6 "2019-07-03T15:47:57Z")

</div>

¿Cómo podría encontrar el archivo mencionado anteriormente de _dns-nameservers_?

---

<div class="post-metadata">

### Author: ![pfaffman](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pfaffman/32/120154_2.png) [@pfaffman](https://meta.discourse.org/u/pfaffman)
#### Post date: [3 Julio, 2019 19:33 UTC](https://meta.discourse.org/t/install-problem-getaddrinfo-name-or-service-not-known/86783/7 "2019-07-03T19:33:26Z")

</div>

Lo siento, @thsnyzkn. ¡Eso habría sido útil de incluir!

Consulta `/etc/network/interfaces`. Si tienes una distribución de Ubuntu más reciente, es posible que en su lugar debas revisar `/etc/netplan/01-netcfg.yaml` (o algo similar en el mismo directorio); Netplan se configura de manera totalmente diferente, pero si está roto podría causar los mismos problemas.

---

<div class="post-metadata">

### Author: ![thsnyzkn](https://avatars.discourse-cdn.com/v4/letter/t/0ea827/32.png) [@thsnyzkn](https://meta.discourse.org/u/thsnyzkn)
#### Post date: [3 Julio, 2019 19:43 UTC](https://meta.discourse.org/t/install-problem-getaddrinfo-name-or-service-not-known/86783/8 "2019-07-03T19:43:29Z")

</div>

No, no necesitas disculparte. De hecho, mencionaste el nombre del archivo antes de ese mensaje en tu publicación anterior. Yo lo siento por no haberlo notado. De todos modos, gracias por tu respuesta.

Sin embargo, sigo atascado con este problema y no sé cómo puedo obtener información útil del comando tcpdump de docker0; parece que se queda colgado cuando se intenta ejecutar el comando _gem update bundler_.

---

<div class="post-metadata">

### Author: ![JammyDodger](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jammydodger/32/254611_2.png) [@JammyDodger](https://meta.discourse.org/u/JammyDodger)
#### Post date: [8 Junio, 2024 12:37 UTC](https://meta.discourse.org/t/install-problem-getaddrinfo-name-or-service-not-known/86783/9 "2024-06-08T12:37:13Z")

</div>

Este tema se cerró automáticamente después de 2226 días. Ya no se permiten nuevas respuestas.
