Docker command with env var prepended (local env var)



我正在使用 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

我怎样才能做到这一点?

设置环境变量可能会有所不同,如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

最新更新