遇到的问题报错:

ERROR: for bs-intel_socintel_1  Cannot start service socintel: OCI runtime create failed: container_linux.go:345: starting container process caused "exec: \"/usr/src/app/entrypoint.sh\": permission denied": unknown

ERROR: for socintel  Cannot start service socintel: OCI runtime create failed: container_linux.go:345: starting container process caused "exec: \"/usr/src/app/entrypoint.sh\": permission denied": unknown
ERROR: Encountered errors while bringing up the project.

Dockerfile 语句

...
# add entrypoint.sh
COPY ./entrypoint.sh /usr/src/app/entrypoint.sh
RUN ["chmod","+x","/usr/src/app/entrypoint.sh"]

# add app
COPY . /usr/src/app

# run server
CMD ["/usr/src/app/entrypoint.sh"]

原因是 Dockerfile中的赋权限的命令根本没有生效。 解决方法:

  1. 在容器外部先赋予执行权限(chmod +x ...)。 这样就相当直接复制一个可执行文件到容器内部。(dockerfile中可删除赋权语句)
  2. 将dockerfile中执行脚本的语句改为
    ENTRYPOINT ["/usr/src/app/entrypoint.sh"]
    

results matching ""

    No results matching ""

    results matching ""

      No results matching ""