When I build my container it seems to compile without any issues using:
docker build -t mycompany:1.0.0 .
When I check docker images
the container displays.
When I try to host it locally using
docker run -p 8081:8081 -it mycompany:1.0.0
it returns an error saying:
Error: Cannot find module '/app/src/myapp.js
I feel like it shouldn't be this complicated. Here is my docker file:
FROM node:10
WORKDIR /app/src
COPY package.json /app
RUN npm install
COPY . /app
CMD node myapp.js
EXPOSE 8081
What is off?
You can see from the error itself , you are not copying anything inside /app/src. Your both COPY command's destination is /app. You need to place myapp.js inside /app/src.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.