Docker – "flower": 在 $PATH 中找不到可执行文件:未知

Docker – "flower": executable file not found in $PATH: unknown

我正在尝试构建一个 Docker 文件。一切顺利,直到最后,当我收到错误消息时:

ERROR: for flower Cannot start service flower: OCI runtime create failed: container_linux.go:380: starting container process caused: exec: "flower": executable file not found in $PATH: unknown

对应compose.yml:

version: "3.9"

services:
  app: &app
    image: registry.gitlab.inria.fr/scripta/escriptorium/app
    build:
      context: .
    env_file: variables.env
    volumes:
      # - ./app/:/usr/src/app/
      - static:/usr/src/app/static
      - media:/usr/src/app/media
    command: /bin/true

  web:
    <<: *app
    command: uwsgi --ini /usr/src/app/uwsgi.ini
    expose:
      - 8000

  channelserver:
    <<: *app
    command: daphne --bind 0.0.0.0 --port 5000 -v 1 escriptorium.asgi:application
    expose:
      - 5000

  db:
    image: postgres:10.5-alpine
    volumes:
      - postgres:/var/lib/postgresql/data/
    env_file: variables.env

  redis:
    image: sickp/alpine-redis:4.0.6

  nginx:
    image: registry.gitlab.inria.fr/scripta/escriptorium/nginx
    build: ./nginx
    environment:
      - SERVERNAME=${DOMAIN:-localhost}
    volumes:
      - type: bind
        source: $PWD/nginx/nginx.conf
        target: /etc/nginx/conf.d/nginx.conf
      - static:/usr/src/app/static
      - media:/usr/src/app/media
    ports:
      - 8080:80

  celery-main:
    <<: *app
    environment:
      - OMP_NUM_THREADS=1
    command: "celery worker -l INFO -E -A escriptorium -Ofair --prefetch-multiplier 1 -Q default -c ${CELERY_MAIN_CONC:-10} --max-tasks-per-child=10"

  celery-live:
    <<: *app
    command: "celery worker -l INFO -E -A escriptorium -Ofair --prefetch-multiplier 1 -Q live -c ${CELERY_LIVE_CONC:-10} --max-tasks-per-child=10"

  celery-low-priority:
    <<: *app
    command: "celery worker -l INFO -E -A escriptorium -Ofair --prefetch-multiplier 1 -Q low-priority -c ${CELERY_LOW_CONC:-10} --max-tasks-per-child=10"

  celery-gpu: &celery-gpu
    <<: *app
    environment:
      - KRAKEN_TRAINING_DEVICE=cpu
    command: "celery worker -l INFO -E -A escriptorium -Ofair --prefetch-multiplier 1 -Q gpu -c 1 --max-tasks-per-child=1"
    shm_size: '3gb'

  flower:
    image: mher/flower
    command: ["flower", "--broker=redis://redis:6379/0", "--port=5555"]
    ports:
      - 5555:5555

  mail:
    build: ./exim
    image: registry.gitlab.inria.fr/scripta/escriptorium/mail
    expose:
      - 25
    environment:
      - PRIMARY_HOST=${DOMAIN:-localhost}
      - ALLOWED_HOSTS=web ; celery-main ; celery-low-priority; docker0

volumes:
   static:
   media:
   postgres:
   esdata:

你需要运行celery --broker=redis://redis:6379/0 flower --port=5555

以下来自flowerofficial docs

From version 1.0.1 Flower uses Celery 5 and has to be invoked in the same style as celery commands do.

您还可以将 celery 特定参数放在此模板之后。

celery [celery args] flower [flower args]

以下 link 是一篇关于此的精彩文章: https://www.distributedpython.com/2018/10/13/flower-docker/

基本上,将“命令”替换为以下内容:

  environment:
    - CELERY_BROKER_URL=redis://redis:6379/0
    - FLOWER_PORT=5555