当我在使用此dockerfile创建的图像上运行docker时,我遇到了问题:
FROM node
WORKDIR /Saiph
EXPOSE 3000
ENTRYPOINT ["npm", "start"]
COPY . /Saiph
RUN npm install
错误是这样的:
PS D:\saiph> docker run 1ba8ca0d9b3b
npm info it worked if it ends with ok
npm info using npm@5.3.0
npm info using node@v8.4.0
npm info lifecycle saiph@1.0.0~prestart: saiph@1.
npm info lifecycle saiph@1.0.0~start: saiph@1.0.0
> saiph@1.0.0 start /Saiph
> cd server && node server
sh: 1: cd: can't cd to server
npm info lifecycle saiph@1.0.0~start: Failed to e
npm ERR! code ELIFECYCLE
npm ERR! errno 2
npm ERR! saiph@1.0.0 start: `cd server && node server`
npm ERR! Exit status 2
npm ERR!
npm ERR! Failed at the saiph@1.0.0 start script.
我试图理解错误,但我不明白, 抱歉我的英文不好,
由于
答案 0 :(得分:0)
@TarunLalwani
PS D:\seith> docker run 15027498053c ls -al
total 72
drwxr-xr-x 1 root root 4096 Sep 9 19:15 .
drwxr-xr-x 1 root root 4096 Sep 9 19:16 ..
drwxr-xr-x 7 root root 4096 Sep 9 00:41 .git
-rwxr-xr-x 1 root root 6222 Sep 9 00:40 .gitignore
drwxr-xr-x 4 root root 4096 Sep 9 16:29 .vs
drwxr-xr-x 2 root root 4096 Sep 8 22:55 Client
drwxr-xr-x 3 root root 4096 Sep 9 00:38 Database
-rwxr-xr-x 1 root root 92 Sep 9 19:15 Dockerfile
-rwxr-xr-x 1 root root 1089 Sep 9 00:37 LICENSE
drwxr-xr-x 3 root root 4096 Sep 9 00:38 Server
drwxr-xr-x 76 root root 4096 Sep 9 16:29 node_modules
-rwxr-xr-x 1 root root 18807 Sep 9 19:15 package-lock.json
-rwxr-xr-x 1 root root 368 Sep 9 16:29 package.json
答案 1 :(得分:0)
您的问题是Windows和Linux文件系统之间的区别。在Windows中,如果存在名为Server
的文件夹,那么您可以使用cd server
或cd Server
,这样就可以了。
Linux区分大小写。因此,要么更改脚本以使用特定案例,要么将文件夹从Server
重命名为server
。您还需要在代码中执行相同的操作,以将需求和其他文件相关的内容重命名为确切的大小写