Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

When using Docker, the variables in the .env file may not be accessible in the Nest.js app due to the way Docker handles environment variables. Docker copies the environment variables when building the container and these variables are then set in the container's environment at runtime.

However, the .env file is not available inside the container unless it is explicitly copied during the build process. This means that the variables in the .env file are not available to the Nest.js app running inside the container.

To resolve this issue, you can either manually copy the .env file to the container or use a tool like docker-compose to manage environment variables. Another option is to use a package like dotenv to load environment variables from a file at runtime.