具有env var prepended(本地env var)的Docker命令

时间:2015-04-28 20:51:04

标签: python shell docker environment-variables docker-compose

我正在使用Docker Compose来启动一些容器,但我没有让command正常工作。我想启动我的Flask服务器,但也为它设置了一个env var。这就是我所做的:

web:
  command: INSTASONG_ENV=production python manage.py runserver

不幸的是,我收到了这个错误:

Cannot start container 2a413b1270b9faa5e0ffb8a70603ae25c48ff742e0d8476bed8153febcee185a: [8] System error: exec: "INSTASONG_ENV=production": executable file not found in $PATH

我该如何做到这一点?

1 个答案:

答案 0 :(得分:4)

设置环境变量的设置可能不同,如tests/fixtures/extends/common.yml

中所示
web:
  image: busybox
  command: /bin/true
  environment:
    - FOO=1
    - BAR=1

在你的情况下:

web:
  command: python manage.py runserver
  environment:
    - INSTASONG_ENV=production