dockerfile找不到entrypoint.sh

时间:2020-02-06 14:22:02

标签: docker dockerfile docker-entrypoint

我的文件系统:

  • Dockerfile
  • entrypoint.sh
  • package.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"]

package.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"
  }
}

entrypoint.sh

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

命令行-bash脚本

如果我运行此代码(请注意:将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"

如果我删除对入口点的引用,那么代码就起作用了,那么入口点怎么回事?

任何建议。 谢谢

1 个答案:

答案 0 :(得分:0)

好的,其他人发布了有关行尾的答案。我使用了原子行结束选择器,并将其替换为LF,并重新保存了文件,现在它可以工作了。