title: Why does Docker gets stuck after running npm install?
body: <p>Im facing a problem when I try to run some containers with docker-compose. One of them a React project. The problem is that when docker tries building the React project, it builds fine, without any problems but... it stucks at the end of the build process and doesnt continue with the other steps of the Dockerfile. Im pretty new to Docker, so I guess I must have missed something, but it seems ok to me.</p>
  <hr />
  <p><strong>What I've tried:</strong></p>
  <p>At the root of the React project, where the Dockerfile is, I executed 'docker build .' and it shows this:</p>
  <p><strong>console output:</strong></p>
  <pre><code>Step 4/6 : RUN npm install --production
   ---&gt; Running in 272b40588564
  npm WARN deprecated babel-eslint@10.1.0: babel-eslint is now @babel/eslint-parser. This package will no longer receive updates.
  npm WARN deprecated chokidar@2.1.8: Chokidar 2 will break on node v14+. Upgrade to chokidar 3 with 15x less dependencies.
  npm WARN deprecated querystring@0.2.1: The querystring API is considered Legacy. new code should use the URLSearchParams API instead.
  npm WARN deprecated svgo@1.3.2: This SVGO version is no longer supported. Upgrade to v2.x.x.
  npm WARN deprecated @hapi/joi@15.1.1: Switch to 'npm install joi'
  npm WARN deprecated rollup-plugin-babel@4.4.0: This package has been deprecated and is no longer maintained. Please use @rollup/plugin-babel.
  npm WARN deprecated fsevents@1.2.13: fsevents 1 will break on node v14+ and could be using insecure binaries. Upgrade to fsevents 2.
  npm WARN deprecated uuid@3.4.0: Please upgrade  to version 7 or higher.  Older versions may use Math.random() in certain circumstances, which is known to be problematic.  See https://v8.dev/blog/math-random for details.
  npm WARN deprecated querystring@0.2.0: The querystring API is considered Legacy. new code should use the URLSearchParams API instead.
  npm WARN deprecated sane@4.1.0: some dependency vulnerabilities fixed, support for node &lt; 10 dropped, and newer ECMAScript syntax/features added
  npm WARN deprecated flatten@1.0.3: flatten is deprecated in favor of utility frameworks such as lodash.
  npm WARN deprecated urix@0.1.0: Please see https://github.com/lydell/urix#deprecated
  npm WARN deprecated @hapi/bourne@1.3.2: This version has been deprecated and is no longer supported or maintained
  npm WARN deprecated @hapi/hoek@8.5.1: This version has been deprecated and is no longer supported or maintained
  npm WARN deprecated @hapi/address@2.1.4: Moved to 'npm install @sideway/address'
  npm WARN deprecated @hapi/topo@3.1.6: This version has been deprecated and is no longer supported or maintained
  npm WARN deprecated resolve-url@0.2.1: https://github.com/lydell/resolve-url#deprecated
  npm WARN deprecated core-js@2.6.12: core-js@&lt;3.3 is no longer maintained and not recommended for usage due to the number of issues. Because of the V8 engine whims, feature detection in old core-js versions could cause a slowdown up to 100x even if nothing is polyfilled. Please, upgrade your dependencies to the actual version of core-js.
  
  &gt; core-js@2.6.12 postinstall /app/node_modules/babel-runtime/node_modules/core-js
  &gt; node -e &quot;try{require('./postinstall')}catch(e){}&quot;
  
  Thank you for using core-js ( https://github.com/zloirock/core-js ) for polyfilling JavaScript standard library!
  
  The project needs your help! Please consider supporting of core-js on Open Collective or Patreon:
  &gt; https://opencollective.com/core-js
  &gt; https://www.patreon.com/zloirock
  
  Also, the author of core-js ( https://github.com/zloirock ) is looking for a good job -)
  
  
  &gt; core-js@3.18.3 postinstall /app/node_modules/core-js
  &gt; node -e &quot;try{require('./postinstall')}catch(e){}&quot;
  
  Thank you for using core-js ( https://github.com/zloirock/core-js ) for polyfilling JavaScript standard library!
  
  The project needs your help! Please consider supporting of core-js:
  &gt; https://opencollective.com/core-js
  &gt; https://patreon.com/zloirock
  &gt; https://paypal.me/zloirock
  &gt; bitcoin: bc1qlea7544qtsmj2rayg0lthvza9fau63ux0fstcz
  
  Also, the author of core-js ( https://github.com/zloirock ) is looking for a good job -)
  
  
  &gt; core-js-pure@3.18.3 postinstall /app/node_modules/core-js-pure
  &gt; node -e &quot;try{require('./postinstall')}catch(e){}&quot;
  
  Thank you for using core-js ( https://github.com/zloirock/core-js ) for polyfilling JavaScript standard library!
  
  The project needs your help! Please consider supporting of core-js:
  &gt; https://opencollective.com/core-js
  &gt; https://patreon.com/zloirock
  &gt; https://paypal.me/zloirock
  &gt; bitcoin: bc1qlea7544qtsmj2rayg0lthvza9fau63ux0fstcz
  
  Also, the author of core-js ( https://github.com/zloirock ) is looking for a good job -)
  
  
  &gt; ejs@2.7.4 postinstall /app/node_modules/ejs
  &gt; node ./postinstall.js
  
  Thank you for installing EJS: built with the Jake JavaScript build tool (https://jakejs.com/)
  
  npm notice created a lockfile as package-lock.json. You should commit this file.
  npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@^2.1.3 (node_modules/react-scripts/node_modules/fsevents):
  npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@2.3.2: wanted {&quot;os&quot;:&quot;darwin&quot;,&quot;arch&quot;:&quot;any&quot;} (current: {&quot;os&quot;:&quot;linux&quot;,&quot;arch&quot;:&quot;x64&quot;})
  npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@^1.2.7 (node_modules/watchpack-chokidar2/node_modules/chokidar/node_modules/fsevents):
  npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.13: wanted {&quot;os&quot;:&quot;darwin&quot;,&quot;arch&quot;:&quot;any&quot;} (current: {&quot;os&quot;:&quot;linux&quot;,&quot;arch&quot;:&quot;x64&quot;})
  npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@^1.2.7 (node_modules/webpack-dev-server/node_modules/chokidar/node_modules/fsevents):
  npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.13: wanted {&quot;os&quot;:&quot;darwin&quot;,&quot;arch&quot;:&quot;any&quot;} (current: {&quot;os&quot;:&quot;linux&quot;,&quot;arch&quot;:&quot;x64&quot;})
  npm WARN bootstrap@5.1.3 requires a peer of @popperjs/core@^2.10.2 but none is installed. You must install peer dependencies yourself.
  npm WARN @babel/plugin-bugfix-v8-spread-parameters-in-optional-chaining@7.15.4 requires a peer of @babel/core@^7.13.0 but none is installed. You must install peer dependencies yourself.
  npm WARN tsutils@3.21.0 requires a peer of typescript@&gt;=2.8.0 || &gt;= 3.2.0-dev || &gt;= 3.3.0-dev || &gt;= 3.4.0-dev || &gt;= 3.5.0-dev || &gt;= 3.6.0-dev || &gt;= 3.6.0-beta || &gt;= 3.7.0-dev || &gt;= 3.7.0-beta but none is installed. You must install peer dependencies yourself.
  
  added 1932 packages from 808 contributors and audited 1935 packages in 114.216s
  
  159 packages are looking for funding
    run `npm fund` for details
  
  found 27 vulnerabilities (8 moderate, 18 high, 1 critical)
    run `npm audit fix` to fix them, or `npm audit` for details
  </code></pre>
  <p>and that's it, it doesn't go anywhere else.</p>
  <hr />
  <p>I've tried different versions of Node and it doesn't change anything. Also, sometimes, if I Ctrl + C out of it, docker gets to save the image to the cache and <em>somehow</em> it manages to deploy it after running 'docker run image <em>...</em>'</p>
  <p><strong>Dockerfile:</strong></p>
  <pre><code>FROM node:14.17 as build
  WORKDIR /app
  COPY package.json ./
  RUN npm install --production
  COPY . ./
  CMD [&quot;npm&quot;,&quot;start&quot;]
  </code></pre>
  <p><strong>package.json of the React project:</strong></p>
  <pre><code>{
    &quot;name&quot;: &quot;crm-react&quot;,
    &quot;version&quot;: &quot;0.1.0&quot;,
    &quot;private&quot;: true,
    &quot;dependencies&quot;: {
      &quot;@hookform/resolvers&quot;: &quot;^2.8.0&quot;,
      &quot;@material-ui/core&quot;: &quot;^4.12.3&quot;,
      &quot;@material-ui/lab&quot;: &quot;^4.0.0-alpha.60&quot;,
      &quot;@testing-library/jest-dom&quot;: &quot;^5.14.1&quot;,
      &quot;@testing-library/react&quot;: &quot;^11.2.7&quot;,
      &quot;@testing-library/user-event&quot;: &quot;^12.8.3&quot;,
      &quot;axios&quot;: &quot;^0.21.1&quot;,
      &quot;bootstrap&quot;: &quot;^5.1.0&quot;,
      &quot;chart.js&quot;: &quot;^3.5.0&quot;,
      &quot;nanoid&quot;: &quot;^3.1.25&quot;,
      &quot;react&quot;: &quot;^17.0.2&quot;,
      &quot;react-chartjs-2&quot;: &quot;^3.0.4&quot;,
      &quot;react-dom&quot;: &quot;^17.0.2&quot;,
      &quot;react-dropzone&quot;: &quot;^11.4.2&quot;,
      &quot;react-hook-form&quot;: &quot;^7.14.2&quot;,
      &quot;react-icons&quot;: &quot;^4.2.0&quot;,
      &quot;react-router-dom&quot;: &quot;^5.2.0&quot;,
      &quot;react-scripts&quot;: &quot;^4.0.3&quot;,
      &quot;web-vitals&quot;: &quot;^1.1.2&quot;,
      &quot;yup&quot;: &quot;^0.32.9&quot;
    },
    &quot;scripts&quot;: {
      &quot;start&quot;: &quot;react-scripts start&quot;,
      &quot;build&quot;: &quot;react-scripts build&quot;,
      &quot;test&quot;: &quot;react-scripts test&quot;,
      &quot;eject&quot;: &quot;react-scripts eject&quot;
    },
    &quot;eslintConfig&quot;: {
      &quot;extends&quot;: [
        &quot;react-app&quot;,
        &quot;react-app/jest&quot;
      ]
    },
    &quot;browserslist&quot;: {
      &quot;production&quot;: [
        &quot;&gt;0.2%&quot;,
        &quot;not dead&quot;,
        &quot;not op_mini all&quot;
      ],
      &quot;development&quot;: [
        &quot;last 1 chrome version&quot;,
        &quot;last 1 firefox version&quot;,
        &quot;last 1 safari version&quot;
      ]
    }
  }
  </code></pre>
  <p>Thanks in advance!</p>