简体   繁体   English

如何解决 docker-entrypoint.sh executable file not found in $PATH: unknown?

[英]How to solve docker-entrypoint.sh executable file not found in $PATH: unknown?

I'm having trouble while trying to start the backend for my application on Docker. I get the following error when I select Compose Up on VS Code.我在 Docker 上尝试为我的应用程序启动后端时遇到问题。当我在 VS Code 上 select Compose Up 时出现以下错误。 I read that I need to add RUN chmod -x docker-entrypoint.sh on my Dockerfile, but it didn't solved the problem.我读到我需要在我的 Dockerfile 上添加RUN chmod -x docker-entrypoint.sh ,但它并没有解决问题。

Successfully built some_id_abc123
mongodb is up-to-date
cache is up-to-date
Recreating some_project_server ... error

ERROR: for some_project_server Cannot start service server: OCI runtime create failed: container_linux.go:370: starting container process caused: exec: "docker-entrypoint.sh": executable file not found in $PATH: unknown

ERROR: for server  Cannot start service server: OCI runtime create failed: container_linux.go:370: starting container process caused: exec: "docker-entrypoint.sh": executable file not found in $PATH: unknown
ERROR: Encountered errors while bringing up the project.
The terminal process "/bin/zsh '-c', 'docker-compose -f "docker-compose.yml" up -d --build'" terminated with exit code: 1.

Dockerfile: Dockerfile:

FROM node
WORKDIR /usr/app
COPY package*.json ./
RUN npm install
COPY . .
EXPOSE 3000
CMD npm run dev 

docker-compose.yml: docker-compose.yml:

version: "3"

services:
  database:
    image: mongo
    container_name: mongodb
    restart: always
    ports: 
      - "27017:27017"
    environment:
      - MONGO_INITDB_DATABASE=some_db
      - MONGO_INITDB_ROOT_USERNAME=some_user
      - MONGO_INITDB_ROOT_PASSWORD=some_password
    volumes:
      - ./mongo-init.js:/docker-entrypoint-initdb.d/mongo-init.js:ro
      - ./mongo-volume:/data/db
    networks:
      - server-network

  redis:
    image: redis
    container_name: cache
    command: redis-server --requirepass some_password
    restart: always
    volumes:
      - ./redis-data:/var/lib/redis
    ports:
      - "6379:6379"
    networks:
      - server-network

  server:
    build: .
    depends_on:
      - database
      - redis
    environment:
      - ENV_VARIABLES=some_env_variables
    ports:
      - "3000:3000"
    volumes:
      - .:/usr/app
    networks:
      - server-network

networks:
  server-network:
    driver: bridge

Finally, here's the file structure of the project:最后,这是项目的文件结构:

project
  - src
  - test
  - .dockerignore
  - docker-compose.yml
  - Dockerfile
  - mongo-init.js
  - package-lock.json
  - package.json

What is this problem's origin and how to solve it?这个问题的根源是什么,如何解决? I'm starting with Docker and this is my first professional project I'm working that Docker is necessary.我从 Docker 开始,这是我工作的第一个专业项目,Docker 是必要的。

Try docker compose build and next docker compose up Found it HERE Worked for me.尝试docker compose build和下一个docker compose up这里找到它对我有用。

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

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