简体   繁体   English

“docker-entrypoint.sh\”:在 $PATH 中找不到可执行文件

[英]“docker-entrypoint.sh\”: executable file not found in $PATH

I'm a noob with Docker and I keep getting this error for pretty much whatever I place inside my Dockerfile, and I'd like to know how to fix it:我是 Docker 的菜鸟,我在 Dockerfile 中放置的几乎所有内容都会出现此错误,我想知道如何解决它:

FROM node:12.18.2-alpine

COPY --chown=node:node . .

USER node

CMD [ "node", "server.js" ]

I've simplified my Dockerfile since I still get the same error anyways.我已经简化了我的 Dockerfile,因为无论如何我仍然遇到相同的错误。

docker-compose.yml file: docker-compose.yml 文件:

version: '3'

services:
  sharpimg:
    build:
      context: .
      dockerfile: Dockerfile
    image: sharpimg
    container_name: sharpcontainer
    restart: unless-stopped
    env_file: .env
    ports:
      - "80:3000"
    volumes:
      - .:/home/sharpimg/app
      - node_modules:/home/node/app/node_modules
    command: nodemon --ignore './dist/' server.js

volumes:
   node_modules:

Versions:版本:

Ubuntu 20
Docker version 19.03.8
docker-compose version 1.26.2

Full error:完整错误:

$ sudo docker-compose up --build; docker-compose logs
Removing sharpcontainer
Building sharpimg
Step 1/4 : FROM node:12.18.2-alpine
 ---> 057fa4cc38c2
Step 2/4 : COPY --chown=node:node . .
 ---> Using cache
 ---> ec6d6aaf78fe
Step 3/4 : USER node
 ---> Using cache
 ---> 7a11c49c015a
Step 4/4 : CMD [ "nodemon", "server.js" ]
 ---> Using cache
 ---> e695913b2d66
Successfully built e695913b2d66
Successfully tagged sharpimg:latest
Recreating 6bc5228b5b83_sharpcontainer ... error

ERROR: for 6bc5228b5b83_sharpcontainer  Cannot start service sharpimg: OCI runtime create failed: container_linux.go:349: starting container process caused "exec: \"docker-entrypoint.sh\": executable file not found in $PATH": unknown

ERROR: for sharpimg  Cannot start service sharpimg: OCI runtime create failed: container_linux.go:349: starting container process caused "exec: \"docker-entrypoint.sh\": executable file not found in $PATH": unknown
ERROR: Encountered errors while bringing up the project.
Attaching to sharpcontainer, 6bc5228b5b83_sharpcontainer

I've upgraded docker and docker-compose and I don't even use a docker-entrypoint.sh file so I'm not really understanding this error.我已经升级了 docker 和 docker-compose 并且我什至不使用docker-entrypoint.sh文件所以我并不真正理解这个错误。 Please help请帮忙

The docker-entrypoint.sh is the entrypoint script for node docker image. docker-entrypoint.sh是节点 docker 映像的入口点脚本。 When you changed the user, maybe you lost the $PATH and therefore the script was not found.当您更改用户时,可能您丢失了$PATH ,因此找不到该脚本。 Try to keep the same user, and if doesn't work, maybe when you copy, you override the script?尝试保留相同的用户,如果不起作用,也许当您复制时,您会覆盖脚本? Please check here how is the suggested usage of node image.请在此处查看节点图像的建议用法。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM