Articles → DOCKER → Environmental Variable Inside The Docker Container
Environmental Variable Inside The Docker Container
Is The Environmental Created Inside The Container Or The Underlying Operating System?
Prerequisite
Create A Container With Environmental Variables
docker run -e VAR1=value1 -e VAR2=value2 --name environmentvariabledemo -it -d -p 85:80 ubuntu
- VAR1 and VAR2 and environmental variables
- environmentvariabledemo is the container name
Check The Value Of The Environment Variable
docker exec -it environmentvariabledemo sh
echo $VAR1
Output
Click to Enlarge