0

我的文件系统:

  • Dockerfile
  • 入口点.sh
  • 包.json
  • /shared_volume/

Dockerfile

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"]

包.json

{
  "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"
  }
}

入口点.sh

#!/bin/bash
cp -r /usr/src/cache/. /usr/src/app/.

命令行 - bash 脚本

如果我运行此代码(注意:使用带有 cmder 的 Windows 10,因此 %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"

如果我取出对入口点的引用,那么代码就可以工作,那么入口点是怎么回事?

有什么建议么。谢谢

4

1 回答 1

0

好的,其他人发布了有关行尾的答案。我使用 atom line-ending-selector 并将其设置为 LF 替换,然后重新保存文件,现在它可以工作了。

于 2020-02-06T15:20:12.290 回答