We has setted up continuous integration/deployment on a Node.js web application. The problem is, when the pipeline runs tests in a docker container on the CI server (GitLab CI), npm install fails at random times. The container uses node v5.0.0 and npm v3.3.6. The output of the NPM install is:

npm ERR! network getaddrinfo ENOTFOUND registry.npmjs.org registry.npmjs.org:443
npm ERR! network This is most likely not a problem with npm itself
npm ERR! network and is related to network connectivity.
npm ERR! network In most cases you are behind a proxy or have bad network settings.
npm ERR! network
npm ERR! network If you are behind a proxy, please make sure that the
npm ERR! network 'proxy' config is set properly. See: 'npm help config'

I can see that npm cannot fetch 2 times out of 3, so it seems like a network issue, but the CI server is running on Compute Engine (I have faith in Google and NPM registry connection...). So I just tried to restart my Docker service, but it did not work either.