RESOLVED: 1. I added the new environmental variable to the docker-compose.yaml file, so docker knows to load that environmental variable. 2. The .env file is read by docker-compose. In order for changes to the .env file to be read, the containers must be spun up from the command line using docker-compose up.
I added a third environmental variable to my workspace's .env file, deleted my Docker containers and images, and rebuilt the images using the --no-cache flag. Yet when I go into my container's terminal in Docker and echo $VARIABLE_NAME, it comes back empty. The first two environmental variables continue to echo back their expected values.
I’ve also discovered that if I delete the Docker container and images, rename the .env file to something like .envOLD, create a new .env file with different values, quit and restart Docker, and rebuild (using --no-cache) and restart the containers, echoing the environmental variables in the container will give me the old values. I had expected echo to return the new .env file’s values.
Has anyone else seen this, and if so, how do I fix it?
I added the new environmental variable to the docker-compose.yaml file, so docker knows to load that environmental variable.
The .env file is read by docker-compose. In order for changes to the .env file to be read, the containers must be spun up from the command line using docker-compose up.