Docker: standard_init_linux.go:228: exec 用户进程导致: 没有这样的文件或目录

发布于 2025-01-11 04:19:54 字数 2801 浏览 0 评论 0原文

我得到了这个 docker 文件:

version: "3.7"


x-web-environment: &web-environment
  environment:
    - PORT=8000
    - ENVIRONMENT_NAME=local_dev
    - USING_DOCKER_COMPOSE=true
    - DJANGO_SETTINGS_MODULE=backend.settings.dev
    - DJANGO_CONFIGURATION=Local
    - DJANGO_ALLOWED_HOSTS=web,localhost
    - DJANGO_CORS_ORIGIN_WHITELIST
    - DJANGO_ADMIN_URL=***
    - POSTGRES_USER=documentcrawler
    - POSTGRES_PASSWORD=*****
    - POSTGRES_HOST=postgres
    - POSTGRES_DB=****
    - DJANGO_SECRET_KEY=*******************
    - REDIS_SERVER_IP=redis
  build:
    context: ./
    dockerfile: Dockerfile.api
  volumes:
    - type: bind
      source: ./
      target: /code
    - type: bind
      source: /tmp
      target: /tmp

services:

  postgres:
    restart: always
    image: postgres:14
    environment:
      - POSTGRES_USER=****
      - POSTGRES_PASSWORD=****
      - POSTGRES_HOST=*****
      - POSTGRES_DB=****
      - PGDATA=/data/pgdata
    volumes:
      - ./pgdata:/data/pgdata
    ports:
      - "5433:5432"

  redis:
    restart: always
    image: redis:latest
    ports:
      - "6379:6379"

  rabbitmq:
    restart: always
    image: rabbitmq:3.9
    environment:
      - RABBITMQ_DEFAULT_USER=****
      - RABBITMQ_DEFAULT_PASS=****
    ports:
      - "5432:5432"


  api:
    <<: *web-environment
    restart: always
    ports:
      - "8000:8000"
    command: "scripts/local/run_web.sh"

  app:
    restart: always
    ports:
      - "3000:3000"
    environment:
      - API_URL=http://api:8000
      - INTERNAL_API_URL=http://api:8000
    build:
      context: ./
      dockerfile: Dockerfile.app

  ctaima:
    <<: *web-environment
    restart: always
    build:
      context: .
      dockerfile: Dockerfile
    command: ["dramatiq", "-p", "1", "-t", "1", "crawler.tasks.broker:rabbitmq_broker", "--queues", "ctaima"]
    shm_size: "4gb"


  redis:
    image: redis:alpine
    ports:
      - "6379:6379"

我的 Dockerfile.api:

FROM python:3.8
ENV PYTHONUNBUFFERED 1

# Add system dependencies
RUN apt update && apt install postgresql gcc python3-dev musl-dev libffi-dev make python3-watchdog -y

# Allows docker to cache installed dependencies between builds
COPY Pipfile* ./
RUN pip install pipenv
RUN pipenv install --dev --system --deploy --ignore-pipfile

# Adds our application code to the image
COPY . /code/
WORKDIR /code

# Expose Django's port
EXPOSE $PORT
#CMD "scripts/local/run_web.sh"
CMD "scripts/local/run_web.sh"

我的树:

scripts/local/run_web.sh
scripts/local/wait_for_postgres.py
scripts/prod/run_web.sh

除了生成错误“standard_init_linux.go:228:执行用户进程导致:没有这样的文件或目录”的 API 容器之外,所有容器都工作正常,

我该如何解决这个问题?非常感谢你!

这是一个继承的项目,不是我的,我不知道如何解决它,我希望你能帮我一把。

I got this docker file:

version: "3.7"


x-web-environment: &web-environment
  environment:
    - PORT=8000
    - ENVIRONMENT_NAME=local_dev
    - USING_DOCKER_COMPOSE=true
    - DJANGO_SETTINGS_MODULE=backend.settings.dev
    - DJANGO_CONFIGURATION=Local
    - DJANGO_ALLOWED_HOSTS=web,localhost
    - DJANGO_CORS_ORIGIN_WHITELIST
    - DJANGO_ADMIN_URL=***
    - POSTGRES_USER=documentcrawler
    - POSTGRES_PASSWORD=*****
    - POSTGRES_HOST=postgres
    - POSTGRES_DB=****
    - DJANGO_SECRET_KEY=*******************
    - REDIS_SERVER_IP=redis
  build:
    context: ./
    dockerfile: Dockerfile.api
  volumes:
    - type: bind
      source: ./
      target: /code
    - type: bind
      source: /tmp
      target: /tmp

services:

  postgres:
    restart: always
    image: postgres:14
    environment:
      - POSTGRES_USER=****
      - POSTGRES_PASSWORD=****
      - POSTGRES_HOST=*****
      - POSTGRES_DB=****
      - PGDATA=/data/pgdata
    volumes:
      - ./pgdata:/data/pgdata
    ports:
      - "5433:5432"

  redis:
    restart: always
    image: redis:latest
    ports:
      - "6379:6379"

  rabbitmq:
    restart: always
    image: rabbitmq:3.9
    environment:
      - RABBITMQ_DEFAULT_USER=****
      - RABBITMQ_DEFAULT_PASS=****
    ports:
      - "5432:5432"


  api:
    <<: *web-environment
    restart: always
    ports:
      - "8000:8000"
    command: "scripts/local/run_web.sh"

  app:
    restart: always
    ports:
      - "3000:3000"
    environment:
      - API_URL=http://api:8000
      - INTERNAL_API_URL=http://api:8000
    build:
      context: ./
      dockerfile: Dockerfile.app

  ctaima:
    <<: *web-environment
    restart: always
    build:
      context: .
      dockerfile: Dockerfile
    command: ["dramatiq", "-p", "1", "-t", "1", "crawler.tasks.broker:rabbitmq_broker", "--queues", "ctaima"]
    shm_size: "4gb"


  redis:
    image: redis:alpine
    ports:
      - "6379:6379"

My Dockerfile.api:

FROM python:3.8
ENV PYTHONUNBUFFERED 1

# Add system dependencies
RUN apt update && apt install postgresql gcc python3-dev musl-dev libffi-dev make python3-watchdog -y

# Allows docker to cache installed dependencies between builds
COPY Pipfile* ./
RUN pip install pipenv
RUN pipenv install --dev --system --deploy --ignore-pipfile

# Adds our application code to the image
COPY . /code/
WORKDIR /code

# Expose Django's port
EXPOSE $PORT
#CMD "scripts/local/run_web.sh"
CMD "scripts/local/run_web.sh"

My tree:

scripts/local/run_web.sh
scripts/local/wait_for_postgres.py
scripts/prod/run_web.sh

All containers work perfectly except the API container that generates the error "standard_init_linux.go:228: exec user process caused: no such file or directory"

How can i fix that? thanks u so much!

It is an inherited project that is not mine and I don't know how I can solve it, I hope you can give me a hand.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文