芹菜:通过Dockerfi中的CMD传递Docker变量

2024-05-22 09:37:18 发布

您现在位置:Python中文网/ 问答频道 /正文

Docker run不会使用此命令启动conatiner

celery -A proj worker -Ofair --concurrency=600 --without-gossip --time-limit=500 --pool=gevent -l info -n $(uuidgen -r)

但是,它将从以下命令开始:

celery -A proj worker -Ofair --concurrency=600 --without-gossip --time-limit=500 --pool=gevent -l info -n celery1

这是在ubuntu18.04 LTS上。如果我在终端上运行这个命令,芹菜就不会有问题了

Dockerfile文件

#Download base image ubuntu 16.04
FROM python:3.6-slim

COPY . .

RUN pip install -r requirements.txt

EXPOSE 80 443 6379 9200 9300

CMD celery -A proj worker -Ofair --concurrency=600 --without-gossip --time-limit=500 --pool=gevent -l info -n $(uuidgen -r)``

我希望它为芹菜实例生成一个uuid,就像在终端中运行时一样


Tags: 命令info终端timegeventcelerywithoutconcurrency