kubernetes giving error,but code works

6/20/2018

every time when deploying this images getting this error`

module.js:540
    throw err;
     ^
Error: Cannot find module '/app/index.js'
at Function.Module._resolveFilename (module.js:538:15)
at Function.Module._load (module.js:468:25)
at Function.Module.runMain (module.js:684:10)
at startup (bootstrap_node.js:187:16)
at bootstrap_node.js:608:3

but code works on pc,I hadn't get error for other deployments they was done this way

dockerfile`

FROM node:8.9
ENV port 3000
WORKDIR /app
COPY package.json /app
RUN npm install
COPY . /app
CMD ["sh", "-c", "node index.js --port=${port}"]

yaml `

enter image description here

output of RUN ls -la after COPY ./app

Step 7/8 : RUN ls -la
 ---> Running in 9e24667abd49
total 76
drwxr-xr-x  9 root root  4096 Jun 21 07:14 .
drwxr-xr-x 57 root root  4096 Jun 21 07:14 ..
-rw-rw-r--  1 root root    30 May 31 09:00 .dockerignore
-rw-rw-r--  1 root root   151 Jun 21 07:14 Dockerfile
-rw-rw-r--  1 root root   556 Jun 20 15:16 api.yaml
drwxrwxr-x  2 root root  4096 May 23 09:03 controllers
-rw-rw-r--  1 root root   446 Jun 20 15:18 index.js
drwxrwxr-x  3 root root  4096 May 15 11:27 insert
drwxrwxr-x  3 root root  4096 May 15 11:27 modules
drwxr-xr-x 69 root root  4096 Jun 20 15:07 node_modules
-rw-r--r--  1 root root 20404 Jun 20 15:07 package-lock.json
-rw-rw-r--  1 root root   328 May 31 09:02 package.json
drwxrwxr-x  2 root root  4096 May 15 11:27 services
drwxrwxr-x  2 root root  4096 Jun 14 14:56 settings
drwxrwxr-x  2 root root  4096 May 23 09:35 utilities

just forget this!!I've tagged the same container as new version,pushed and its works!

-- Grigor
docker
kubernetes
node.js

1 Answer

6/21/2018

Answered by Grigor:

I've tagged the same container as new version,pushed and its works!

-- VAS
Source: StackOverflow