Reputation: 58750
I'm trying to deploy my NodeJS ExpressJS API in a Docker container running in my EC2.
I'm not sure why my container does not recognize the value of my .env that I created via my container definition.
When I run npm start
I got this error.
How would one go about debugging this further?
Upvotes: 0
Views: 1818
Reputation: 6653
Any hints/suggestions / helps on this be will be much appreciated!
You might check for two things here one by one:
That your env variables are actually properly passed to your running container (should be the case) by explicitly listing them from within container shell command like so:
echo $ADMIN_PWD # and so on other variables to make sure they have values...
My assumption is that you should see proper values here. If you don't then you should see if you wipe them out somehow during container init.
If first step is ok, you should check if nodeJS is properly reading available ENV variables. There is a number of ways you could read them from your code (process.env.VARNAME
or by reading them from .env
file and by using other modules than dotenv
to do so...). Check that on running container .env
file is present and properly populated since it is often on .gitignore
, and if you use any other module check that all required files are present on container.
Upvotes: 2