title: How to install yarn on docker FROM node:9.11.2-alpine?
body: <p>my docker</p>
  
  <pre><code> - FROM node:9.11.2-alpine
   - RUN apk add yarn
  </code></pre>
  
  <p>And error: </p>
  
  <pre><code>yarn (missing):    required by: world[yarn]
  [91mWARNING: Ignoring APKINDEX.84815163.tar.gz: No such file or directory
  WARNING: Ignoring APKINDEX.24d64ab1.tar.gz: No such file or directory
  ERROR: unsatisfiable constraints:
  The command '/bin/sh -c apk add yarn' returned a non-zero code: 1
  
  [Sat Jun 23 2018 16:04:57 GMT+0100 (GMT Daylight Time)] ERROR Child process exited with code 1
  </code></pre>
  
  <p>I can't understand why is so hard to add Yarn to a docker. I tried so many things and all fails in some ways or another.</p>
  
  <p>Until yesterday I was able to install Yarn on my docker with <code>RUN npm install -g yarn</code> but this morning stopped working with error:</p>
  
  <blockquote>
    <p>request to <a href="https://registry.npmjs.org/yarn" rel="noreferrer">https://registry.npmjs.org/yarn</a> failed, reason: getaddrinfo EAI_AGAIN registry.npmjs.org:443</p>
  </blockquote>
  
  <p>Some of the things I've tried: </p>
  
  <ul>
  <li>No results for "inurl:yarnpkg.com docker" in google</li>
  <li><a href="https://github.com/mhart/alpine-node/issues/65" rel="noreferrer">https://github.com/mhart/alpine-node/issues/65</a> </li>
  </ul>
  
  <p><strong>Edit one day after:</strong></p>
  
  <p>Now when I do <code>yarn install</code> I'm getting <code>getaddrinfo EAI_AGAIN registry.yarnpkg.com:443</code> errors on every package.</p>
  
  <p>looks like restarting docker fixes it. Also more info at <a href="https://development.robinwinslow.uk/2016/06/23/fix-docker-networking-dns/" rel="noreferrer">https://development.robinwinslow.uk/2016/06/23/fix-docker-networking-dns/</a></p>