Getting Data In

Why is my node_modules folder deleted after docker build?


Hi guys!

I'm currently building a docker container with splunk/universalforwarder:7.0.0-monitor-k8s-logs as base image. During my docker build i install my own node.js and want to add my own scriptedinput scripts.

my eventhub folder:



FROM splunk/universalforwarder:7.0.0-monitor-k8s-logs

RUN apt-get update \ 
 && apt-get install curl -y \
 && curl -sL | bash \
 && sudo apt-get install -y nodejs 

COPY eventhub  /opt/splunk/etc/apps/eventhub/

WORKDIR /opt/splunk/etc/apps/eventhub/bin/

RUN npm i --production && ls -al  <==

ls -al gives me that all are successfully created:


However running my new image, the node_modules folder and package.json.lock is missing. After doing a manual npm install in the container everything is working.

Copying the files to /opt/splunk/ and doing the npm install there and not to /opt/splunk/etc the files are there.

I think it has something to do with the base image volumes of /opt/splunk/etc and /opt/splunk/etc see: But i cant't figure out what...I don't run splunk when running the image so i don't know how the volumes getting manipulated and also why only the npm install files getting deleted.

Thanks for your help!

0 Karma