Hello,
I’m trying to change PATH within my node and it works fine but only if I’m directly in the node, see examples:
$ docker run -it frontiersco/simpleweb echo $PATH
/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin
$ docker run -it frontiersco/simpleweb sh
/opt/node_app/app # echo $PATH
/opt/node_app/node_modules/.bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
/opt/node_app/app #
Why the PATH is different…? Shouldn’t that be the same?
Dockerfile
FROM node:alpine
WORKDIR /opt/node_app
COPY package.json package-lock.json* ./
RUN npm install --no-optional && npm cache clean --force
ENV PATH /opt/node_app/node_modules/.bin:$PATH
WORKDIR /opt/node_app/app
COPY . .
Here is my version:
Docker version 19.03.13, build cd8016b6bc