title: Docker blocked on NPM install - Socket Timeout
body: <p>I have a simple Dockerfile which is running node, this is the configuration:</p>
  <pre><code>FROM node:latest
  
  WORKDIR /usr/src/auth-starter-server
  
  COPY ./ ./
  
  RUN npm install
  
  CMD [&quot;sh&quot;]
  </code></pre>
  <p>Which is being used on a docker-compose.yml as such:</p>
  <pre><code>version: &quot;3.8&quot;
  
  services:
    # Node Server
    auth-starter-server:
      container_name: server
      restart: unless-stopped
      build: ./
      command: npm run start:live
      working_dir: /usr/src/auth-starter-server
      ports:
        - &quot;5000:5000&quot;
      volumes:
        - ./:/usr/src/auth-starter-server
  </code></pre>
  <p>From a day to the other happened I couldn't build the image any longer. It starts without problems,</p>
  <pre><code>Creating network &quot;react-auth-starter_default&quot; with the default driver
  Building auth-starter-server
  Step 1/5 : FROM node:latest
   ---&gt; 6f7f341ab8b8
  Step 2/5 : WORKDIR /usr/src/auth-starter-server
   ---&gt; Using cache
   ---&gt; b25f7c08d3eb
  Step 3/5 : COPY ./ ./
   ---&gt; Using cache
   ---&gt; 2a06e76bab32
  Step 4/5 : RUN npm install
   ---&gt; Running in 0034d6afa38e
  </code></pre>
  <p>but when building with <code>docker-compose up --build</code> (or simply <code>docker build -t auth-starter-server .</code>) it just times out on 'npm install' and it returns the following error:</p>
  <pre><code>npm notice 
  npm notice New minor version of npm available! 7.0.15 -&gt; 7.3.0
  npm notice Changelog: &lt;https://github.com/npm/cli/releases/tag/v7.3.0&gt;
  npm notice Run `npm install -g npm@7.3.0` to update!
  npm notice 
  npm ERR! code ERR_SOCKET_TIMEOUT
  npm ERR! errno ERR_SOCKET_TIMEOUT
  npm ERR! request to https://registry.companyregistry.com/yargs-parser/-/yargs-parser-13.1.2.tgz failed, reason: Socket timeout
  
  npm ERR! A complete log of this run can be found in:
  npm ERR!     /root/.npm/_logs/2020-12-21T15_37_42_509Z-debug.log
  ERROR: Service 'auth-starter-server' failed to build : The command '/bin/sh -c npm install' returned a non-zero code: 1
  </code></pre>
  <p>Something I noticed is that's not using the official npm registry, even though that hasn't been set up as the default registry. Here the npm configuration (got by running <code>npm config ls -l</code>):</p>
  <pre><code>cli configs
  long = true
  metrics-registry = &quot;https://registry.npmjs.org/&quot;
  scope = &quot;&quot;
  user-agent = &quot;npm/6.14.9 node/v15.4.0 darwin x64&quot;
  
  ; builtin config undefined
  prefix = &quot;/usr/local&quot;
  
  ; default values
  access = null
  allow-same-version = false
  also = null
  always-auth = false
  audit = true
  audit-level = &quot;low&quot;
  auth-type = &quot;legacy&quot;
  before = null
  bin-links = true
  browser = null
  ca = null
  cache = &quot;/Users/ale917k/.npm&quot;
  cache-lock-retries = 10
  cache-lock-stale = 60000
  cache-lock-wait = 10000
  cache-max = null
  cache-min = 10
  cafile = undefined
  cert = null
  cidr = null
  color = true
  commit-hooks = true
  depth = null
  description = true
  dev = false
  dry-run = false
  editor = &quot;vi&quot;
  engine-strict = false
  fetch-retries = 2
  fetch-retry-factor = 10
  fetch-retry-maxtimeout = 60000
  fetch-retry-mintimeout = 10000
  force = false
  format-package-lock = true
  fund = true
  git = &quot;git&quot;
  git-tag-version = true
  global = false
  global-style = false
  globalconfig = &quot;/usr/local/etc/npmrc&quot;
  globalignorefile = &quot;/usr/local/etc/npmignore&quot;
  group = 20
  ham-it-up = false
  heading = &quot;npm&quot;
  https-proxy = null
  if-present = false
  ignore-prepublish = false
  ignore-scripts = false
  init-author-email = &quot;&quot;
  init-author-name = &quot;&quot;
  init-author-url = &quot;&quot;
  init-license = &quot;ISC&quot;
  init-module = &quot;/Users/ale917k/.npm-init.js&quot;
  init-version = &quot;1.0.0&quot;
  json = false
  key = null
  legacy-bundling = false
  link = false
  local-address = undefined
  loglevel = &quot;notice&quot;
  logs-max = 10
  ; long = false (overridden)
  maxsockets = 50
  message = &quot;%s&quot;
  ; metrics-registry = null (overridden)
  node-options = null
  node-version = &quot;15.4.0&quot;
  noproxy = null
  offline = false
  onload-script = null
  only = null
  optional = true
  otp = null
  package-lock = true
  package-lock-only = false
  parseable = false
  prefer-offline = false
  prefer-online = false
  ; prefix = &quot;/usr/local/Cellar/node/15.4.0&quot; (overridden)
  preid = &quot;&quot;
  production = false
  progress = true
  proxy = null
  read-only = false
  rebuild-bundle = true
  registry = &quot;https://registry.npmjs.org/&quot;
  rollback = true
  save = true
  save-bundle = false
  save-dev = false
  save-exact = false
  save-optional = false
  save-prefix = &quot;^&quot;
  save-prod = false
  scope = &quot;&quot;
  script-shell = null
  scripts-prepend-node-path = &quot;warn-only&quot;
  searchexclude = null
  searchlimit = 20
  searchopts = &quot;&quot;
  searchstaleness = 900
  send-metrics = false
  shell = &quot;/bin/zsh&quot;
  shrinkwrap = true
  sign-git-commit = false
  sign-git-tag = false
  sso-poll-frequency = 500
  sso-type = &quot;oauth&quot;
  strict-ssl = true
  tag = &quot;latest&quot;
  tag-version-prefix = &quot;v&quot;
  timing = false
  tmp = &quot;/var/folders/2t/36_q44_s62d1b57hnl0l8khw0000gn/T&quot;
  umask = 18
  unicode = true
  unsafe-perm = true
  update-notifier = true
  usage = false
  user = 0
  ; user-agent = &quot;npm/{npm-version} node/{node-version} {platform} {arch} {ci}&quot; (overridden)
  userconfig = &quot;/Users/ale917k/.npmrc&quot;
  version = false
  versions = false
  viewer = &quot;man&quot;
  </code></pre>
  <p>Can it be the reason why it stopped building is because it's pointing to the wrong registry? And if so, how can that be fixed?</p>
  <p>Bit on a side, I noticed as well that warning regarding the npm update; How can I update the npm package inside a docker image?</p>
  <p>Any answer is highly appreciated, so thank you for your inputs!</p>