'Using variable interpolation in Gunicorn inside DockerFile
Looking for a way to pass PORT environment variable to gunicorn command inside DockerFile
current setup
.env
PORT=8080
DockerFile
EXPOSE ${PORT}
CMD ["gunicorn" , "--timeout" , "120" ,"-b", "0.0.0.0:8080", "wsgi:app"]
First attempt
CMD ["gunicorn" , "--timeout" , "120" ,"-b", "0.0.0.0:${PORT}", "wsgi:app"]
Failed
Second attempt
CMD ["gunicorn" , "--timeout" , "120" ,"-b", "0.0.0.0:{PORT}", "wsgi:app"]
Failed
What is the correct way to pass PORT to gunicorn?
Update:
I can run the command in bash successfully
#!/bin/bash
PORT=8879
SERVER_PORT=0.0.0.0:${PORT}
echo ${SERVER_PORT}
gunicorn --bind ${SERVER_PORT} wsgi:app
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
