npm ERR! request to registry.npmjs.org/npm failed, reason: getaddrinfo EADDRNOTAVAIL with docker alpine linux

cli
triaged

(Pranab Dhar) #1

What I Wanted to Do

I am building a docker alpine linux image with nodejs v9.4.0 compiled from source.

The builds were going green until last Thus/Friday 9/13-9/14 when there was a npm registry service interruption from npm registry. This was reported all over the place and since then all the existing builds where we are using a docker alpine linux build with nodejs , those build started failing. This also includes the base image build which builds the nodejs from source.

What Happened Instead

npm ERR! A complete log of this run can be found in:
npm ERR! /root/.npm/_logs/2018-09-17T21_33_52_846Z-debug.log

Reproduction Steps

Create a test Dockerfile with the following contents

   FROM alpine:latest

    RUN echo -e 'http://dl-cdn.alpinelinux.org/alpine/edge/main\nhttp://dl-cdn.alpinelinux.org/alpine/edge/community\nhttp://dl-cdn.alpinelinux.org/alpine/edge/testing' > /etc/apk/repositories
    RUN apk --update add --no-cache openssh-client \
        curl \
        git \
        nodejs \
        nodejs-npm \
        yarn \
        python \
        python-dev \
        py-pip \
        build-base

    RUN yarn --version
    RUN npm init -y
    RUN npm install chai
    RUN yarn init -y
    RUN yarn add chai

Ensure the latest version docker daemon is installed and running.
from command line run " docker build -t testnode ." in the same folder where Dockerfile exists.

Details

At this point it is not clear where the problem lies. is it npm registry service or docker or alpine linux. The only fact I am aware is that this behavior started after the service interruption on 9/13-14/2018

Platform Info

Base OS : Mac OSX 10.13.6
Docker Version: Version 18.06.1-ce-mac73 (26764)
Alpine linux running inside docker container.

Node version being compiled from source 9.4.0
failed while running this command
+ npm install -g npm@5
npm ERR! code EADDRNOTAVAIL
npm ERR! errno EADDRNOTAVAIL
npm ERR! request to registry.npmjs.org/npm failed, reason: getaddrinfo EADDRNOTAVAIL registry.npmjs.org:443

(Pranab Dhar) #2

This is being addressed in alpine linux codebase as explained here https://github.com/yarnpkg/yarn/issues/6384