You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If I try running pm2 in a docker container on Kubernetes using node:alpine or node:latest I am getting errors where a .pm2 folder is trying to be accessed during startup and can't be created.
What is the best practice for handling the .pm2 folder with Kubenetes? My App is failing to start with errors due to the .pm2 folder being unavailable.
I'm starting my app in the Dockerfile like this:
FROM keymetrics/pm2:16-alpine
ENV APP_DIR /dockerApp/myApp
WORKDIR $APP_DIR
...*copy app src files over*
ENV NPM_CONFIG_LOGLEVEL warn
RUN npm install --production
RUN npm install -g pm2
ENV PM2_HOME=/tmp/.pm2
RUN mkdir /tmp/.pm2
CMD ( pm2-runtime start pm2.json --watch )
Should I make a /tmp volume in the container and put the .pm2 folder there using the PM2_HOME environmental variable?
Bigger stack trace:
Error: EROFS: read-only file system, mkdir '/.pm2'
at Object.mkdirSync (node:fs:1336:3)
at mkdirpManualSync (/usr/local/lib/node_modules/pm2/node_modules/mkdirp/lib/mkdirp-manual.js:48:10)
at mkdirpManualSync (/usr/local/lib/node_modules/pm2/node_modules/mkdirp/lib/mkdirp-manual.js:52:43)
at mkdirpNativeSync (/usr/local/lib/node_modules/pm2/node_modules/mkdirp/lib/mkdirp-native.js:33:14)
at Function.mkdirpSync [as sync] (/usr/local/lib/node_modules/pm2/node_modules/mkdirp/index.js:21:7)
at module.exports.Client.initFileStructure (/usr/local/lib/node_modules/pm2/lib/Client.js:133:25)
at new module.exports (/usr/local/lib/node_modules/pm2/lib/Client.js:38:8)
at new API (/usr/local/lib/node_modules/pm2/lib/API.js:108:19)
at Object.<anonymous> (/usr/local/lib/node_modules/pm2/index.js:11:18)
at Module._compile (node:internal/modules/cjs/loader:1097:14)
Error: EROFS: read-only file system, mkdir '/.pm2'
at Object.mkdirSync (node:fs:1336:3)
at mkdirpManualSync (/usr/local/lib/node_modules/pm2/node_modules/mkdirp/lib/mkdirp-manual.js:48:10)
at mkdirpManualSync (/usr/local/lib/node_modules/pm2/node_modules/mkdirp/lib/mkdirp-manual.js:52:43)
at mkdirpNativeSync (/usr/local/lib/node_modules/pm2/node_modules/mkdirp/lib/mkdirp-native.js:33:14)
at Function.mkdirpSync [as sync] (/usr/local/lib/node_modules/pm2/node_modules/mkdirp/index.js:21:7)
at module.exports.Client.initFileStructure (/usr/local/lib/node_modules/pm2/lib/Client.js:141:25)
at new module.exports (/usr/local/lib/node_modules/pm2/lib/Client.js:38:8)
at new API (/usr/local/lib/node_modules/pm2/lib/API.js:108:19)
at Object.<anonymous> (/usr/local/lib/node_modules/pm2/index.js:11:18)
at Module._compile (node:internal/modules/cjs/loader:1097:14)
I tried using the pm2 docker image (FROM keymetrics/pm2:latest-alpine) but I'm getting different errors with that:
2022-01-24T08:40:58: PM2 error: TypeError [ERR_INVALID_ARG_TYPE]: The "data" argument must be of type string or an instance of Buffer, TypedArray, or DataView. Received type number (31)
at Object.writeFileSync (fs.js:1380:5)
at /usr/local/lib/node_modules/pm2/lib/God/ForkMode.js:268:12
at wrapper (/usr/local/lib/node_modules/pm2/node_modules/async/internal/once.js:12:16)
at next (/usr/local/lib/node_modules/pm2/node_modules/async/waterfall.js:96:20)
at /usr/local/lib/node_modules/pm2/node_modules/async/internal/onlyOnce.js:12:16
at WriteStream.<anonymous> (/usr/local/lib/node_modules/pm2/lib/Utility.js:186:13)
at WriteStream.emit (events.js:315:20)
at WriteStream.EventEmitter.emit (domain.js:485:12)
at internal/fs/streams.js:395:12
at FSReqCallback.oncomplete (fs.js:163:23)
The text was updated successfully, but these errors were encountered:
If I try running pm2 in a docker container on Kubernetes using node:alpine or node:latest I am getting errors where a .pm2 folder is trying to be accessed during startup and can't be created.
What is the best practice for handling the .pm2 folder with Kubenetes? My App is failing to start with errors due to the .pm2 folder being unavailable.
I'm starting my app in the Dockerfile like this:
Should I make a /tmp volume in the container and put the .pm2 folder there using the PM2_HOME environmental variable?
Bigger stack trace:
My pm2 json config
I tried using the pm2 docker image (
FROM keymetrics/pm2:latest-alpine
) but I'm getting different errors with that:The text was updated successfully, but these errors were encountered: