FROM node:8
# Create and define the node_modules's cache directory.
RUN mkdir /usr/src/cache
WORKDIR /usr/src/cache
COPY . .
RUN npm install
# Create and define the application's working directory.
RUN mkdir /usr/src/app
WORKDIR /usr/src/app
# entrypoint to copy the node_modules and root files into /usr/src/app, to be shared with my local volume.
ENTRYPOINT ["/usr/src/cache/entrypoint.sh"]
{
"name": "test1",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"start": "echo hello world start"
},
"keywords": [],
"author": "",
"license": "ISC",
"devDependencies": {
"rimraf": "^3.0.1"
}
}
#!/bin/bash
cp -r /usr/src/cache/. /usr/src/app/.
如果我运行此代码(请注意:将Windows 10与cmder一起使用,因此%cd%不是pwd):
docker run -it --rm -v %cd%/shared_volume:/app --privileged shared-volume-example bash
standard_init_linux.go:211: exec user process caused "no such file or directory"
如果我删除对入口点的引用,那么代码就起作用了,那么入口点怎么回事?
任何建议。 谢谢
答案 0 :(得分:0)
好的,其他人发布了有关行尾的答案。我使用了原子行结束选择器,并将其替换为LF,并重新保存了文件,现在它可以工作了。