I'm trying to dockerize a basic nodejs app. My dockerfile is the follow
FROM node:10
WORKDIR /usr/src/app
COPY package*.json ./
RUN npm install
COPY . .
EXPOSE 80
CMD [ "node", "index.js" ]
After i build the image I'm trying to running it with
docker run -p 3000:3000 imagename -e connectionString=myConnString
But I received always the same error
[eval]:1
connectionString=myConnString
ReferenceError: myConnString is not defined
How can I solve?
The docker run syntax is docker run [OPTIONS] IMAGE[:TAG|@DIGEST] [COMMAND] [ARG...], anything passed after the IMAGE[:TAG|@DIGEST] is passed as [COMMAND] [ARG...].
The environment variable setting should be passed in the run [OPTIONS] i.e.: docker run -p 3000:3000 -e connectionString=myConnString imagename
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With