我在AWS Elastic beanstalk中使用自定义Docker容器来部署wep应用程序。我可以在AWS Web控制台上设置API密钥,API密钥等环境变量。(Elastic beanstalk => Configuration => Software Configuration)它工作正常。
但是,在我将一些变量更改为包含特殊字符的其他值后,它不能用于此错误:
Docker container quit unexpectedly on Mon Oct 24 13:32:22 UTC 2016:
Error: Unexpected end of key/value pairs
For help, use /usr/bin/supervisord -h
Supervisord文件说Values containing non-alphanumeric characters should be quoted
。
我的问题是,
有没有办法制作具有特殊字符的环境变量,这些变量是从AWS弹性beanstalk设置的,通过引用它们正确地到达docker容器?
我尝试在网络控制台上引用它们:
Double quoting env vars on web console
但它不起作用:
我认为AWS Elastic beanstalk默认会转义双引号。
了解更多信息。我的ebextension配置文件:
option_settings:
"aws:elasticbeanstalk:application:environment":
MY_VARIABLE: ""
MY_VARIABLE_QUOTED: ""
Supervisord配置文件:
[program:run_app]
environment=MY_VARIABLE=%(ENV_MY_VARIABLE)s,MY_VARIABLE_QUOTED=%(ENV_MY_VARIABLE_QUOTED)s
command=gunicorn my_app.wsgi:application -w 2 -b 0.0.0.0:8000 -t 300 --max-requests=100
directory=/var/www/my_app
user=root
stdout_logfile=/var/www/my_app/logs/django_stdout.log
stderr_logfile=/var/www/my_app/logs/django_stderr.log
autorestart=true
redirect_stderr=true
stopwaitsecs = 600