【问题标题】:how to add dynamic port no in the gunicorn docker?如何在 gunicorn docker 中添加动态端口号?
【发布时间】:2018-11-24 02:22:37
【问题描述】:

我试图在运行 docker 映像时提供动态端口、线程和工作程序,但我收到错误

[root]# docker run -it  -p 8080:8080  --env-file ./env.list  ff50c09659a0
/usr/bin/gunicorn: line 4: import: command not found
/usr/bin/gunicorn: line 5: import: command not found
/usr/bin/gunicorn: line 7: from: command not found
/usr/bin/gunicorn: gunicorn: line 10: syntax error near unexpected token `('
/usr/bin/gunicorn: gunicorn: line 10: `    sys.argv[0] = re.sub(r'(-script\.pyw?|\.exe)?$', '', sys.argv[0])'

在 docker 文件中,我使用的是 ENTRYPOINT

ENTRYPOINT ["/bin/bash","gunicorn","-b :","$port","-w","$worker","-t","$thread","--graceful-timeout","$time","api:APP"]

谁能告诉我为什么会出现这个错误?

【问题讨论】:

    标签: docker gunicorn docker-entrypoint


    【解决方案1】:

    大家好,只需更改 ENTRYPOINT 即可解决问题

    ENTRYPOINT ["/bin/bash","-c","gunicorn -b :$port -w $worker -t $thread --timeout 300 --graceful-timeout $time api:APP"]
    

    【讨论】:

      猜你喜欢
      • 2015-03-02
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-02-26
      • 2016-04-23
      相关资源
      最近更新 更多