Docker on ElasticBeanstalk missing environment variables

amazon-web-servicesdjangodockerelastic-beanstalk

I've configured a Docker container for my Django site that I'm deploying to Amazon's ElasticBeanstalk platform.

Several of my environment variables are configured via an .ebextensions file, and other are set directly in the EB console to keep them out of source control and to let me modify them easier (things like the secret key or admin url).

I'm running into an issue where it looks like the variables I see when I run eb printenv aren't being reflected in the Docker container. For example, when I run docker inspect I'm currently seeing an old version of the DJANGO_ALLOWED_HOSTS variable, and my DJANGO_ADMIN_URL isn't there at all. Neither are several other variables I've set.

I've tried rebuilding my container, terminating the instance and creating it over, and nothing seems to work. These variables refuse to "copy" into the container for some reason that I'm not understanding.

Is there something I'm overlooking?

Best Answer

It appears as though one of my earlier deployments didn't successfully complete and that when EB "switches" from an older version to a newer version, it only removes the old files if the previous version was running.

Long story short, rebuilding the whole environment (not just the container) fixed the issue.