Context: docker-compose to start several containers, including Gunicorn that calls a Flask app. I'm using an environment file web/env.gunicorn
to store my Gunicorn startup configuration. This file contains
GUNICORN_CMD_ARGS="--bind=127.0.0.1:8001 --workers=3"
The problem is that GUNICORN_CMD_ARGS
is not processed correctly somewhere in the pipeline. The error that I get when running docker logs gunicorn
is
Error: '8001 --workers=3' is not a valid port number.
The question is, where in my setup are my assumptions wrong, thereby causing the environment variable to be mangled? The environment variable is accepted when run manually in a terminal. The docker compose file looks as follows
version: "3"
services:
# nginx:
# image: nginx:latest
# ports:
# - "80:80"
# volumes:
# - ./nginx:/etc/nginx/conf.d
# depends_on:
# - web
web:
build: ./web
container_name: gunicorn
ports:
- "8001:8001"
environment:
- APP_CONFIG_FILE=../config/development.py
env_file:
- 'web/env.gunicorn'
networks:
- backend
command: gunicorn thymedata:app
depends_on:
- influxdb
- grafana
influxdb:
image: influxdb:latest
container_name: influxdb
ports:
- "8086:8086"
env_file:
- 'influxdb/env.influxdb'
- 'influxdb/secrets.influxdb'
networks:
- backend
volumes:
- influxdb-data:/var/lib/influxdb
grafana:
image: grafana/grafana:latest
container_name: grafana
ports:
- "3000:3000"
env_file:
- 'grafana/env.grafana'
- 'grafana/secrets.grafana'
networks:
- backend
volumes:
- grafana-data:/var/lib/grafana
depends_on:
- influxdb
networks:
backend:
volumes:
influxdb-data:
grafana-data:
GUNICORN_CMD_ARGS
set, and it accepted it properly (# of workers and address checked). That's why i suppose the problem being on Docker's side.ERROR: build path /home/ben/devopsStackExchange/web either does not exist, is not accessible, or is not a valid URL.
. Please create asteps to reproduce paragraph
and add the required files so that other people could help you by at least allowing them to reproduce the issue.command: gunicorn thymedata:app --bind=127.0.0.1:8001 --workers=3
version, since the variables loaded viaenv_file
are not accepted. They have to already be set in the calling terminal.