Dockerfile Environment Variables
Dockerfile Environment Variables
To make new software easier to run, you can use ENV to update the PATH environment variable for the software that your container installs.
Setup your environment:
Step 1: Make the env Directory
Use the --env flag to pass an environment variable when building an image:
--env [KEY]=[VALUE]
Use the ENV instruction in the Dockerfile:
ENV [KEY]=[VALUE] ENV [KEY] [VALUE]
Step 1: Clone the weather-app:
Step 2: Create the Dockerfile
Create an image for the weather-app
Step 3: Dockerfile contents:
Step 4: Create the weather-app container:
Step 5: Inspect the container to see the environment variables:
Step 6: Deploy the weather-dev application:
Step 7: Inspect the development container to see the environment variables:
Step 8: Deploy the weather-app to production:
Step 9: Inspect the production container to see the environment variables:
Step 10: Get the logs for weather-app2:
Last updated