Facing error in creating image of my react+vite project . Dockerfile error

19 Views Asked by At




FROM node:19.5.0-alpine
RUN npm i -g nodemon
WORKDIR  /app

COPY package* .
RUN pwd
RUN apk update && apk add npm
RUN npm install
COPY . .
RUN pwd
RUN npm run build 

EXPOSE 3007
CMD [ "npm", "run", "preview" ]

In terminal

 docker build -t saathi .

Getting error

                                                                      0.0s
 => CACHED [ 6/10] RUN apk update && apk add npm                                                   0.0s
 => ERROR [ 7/10] RUN npm install                                                                 24.7s
------
 > [ 7/10] RUN npm install:
1.064 npm WARN EBADENGINE Unsupported engine {
1.064 npm WARN EBADENGINE   package: '[email protected]',
1.064 npm WARN EBADENGINE   required: { node: '^18.0.0 || >=20.0.0' },
1.064 npm WARN EBADENGINE   current: { node: 'v19.5.0', npm: '9.3.1' }
1.064 npm WARN EBADENGINE }
24.50 npm ERR! code ERR_SOCKET_TIMEOUT
24.50 npm ERR! network Socket timeout
24.50 npm ERR! network This is a problem related to network connectivity.
24.50 npm ERR! network In most cases you are behind a proxy or have bad network settings.
24.50 npm ERR! network 
24.50 npm ERR! network If you are behind a proxy, please make sure that the
24.50 npm ERR! network 'proxy' config is set properly.  See: 'npm help config'
24.51 
24.51 npm ERR! A complete log of this run can be found in:
24.51 npm ERR!     /root/.npm/_logs/2024-03-31T17_24_20_245Z-debug-0.log
------
Dockerfile:12
--------------------
  10 |     RUN pwd
  11 |     RUN apk update && apk add npm
  12 | >>> RUN npm install
  13 |     COPY . .
  14 |     RUN pwd
--------------------
ERROR: failed to solve: process "/bin/sh -c npm install" did not complete successfully: exit code: 1
(base) riz@riz-Aspier-XXXX:~/Desktop/Saathi/frontend$ 

Can anyone tell me why i am getting this error . I have tried many thing and also search answer on stackoverflow , but all the approach have been failed , in my case .

Why i am getting error after npm install , i am not able to find . Please help me

0

There are 0 best solutions below