Celery:通过 Docker 文件中的 CMD 传递 Docker 变量
Celery: Passing Docker variable through CMD in Dockerfile
Docker 运行 不会使用此命令启动容器。
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
这是在 Ubuntu 18.04 LTS 上进行的。如果我在终端中 运行 该命令,芹菜将毫无问题地启动。
Docker文件
#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)``
我希望它能为 celery 实例生成一个 uuid,就像在终端中 运行 时那样。
因为docker图像上不存在uuidgen。
Docker 运行 不会使用此命令启动容器。
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
这是在 Ubuntu 18.04 LTS 上进行的。如果我在终端中 运行 该命令,芹菜将毫无问题地启动。
Docker文件
#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)``
我希望它能为 celery 实例生成一个 uuid,就像在终端中 运行 时那样。
因为docker图像上不存在uuidgen。