Docker Community Forums

Share and learn in the Docker community.

Environment variables set in docker run are not seen in powershell sessions


Might be the wrong forum to ask but where exactly withing Windows environment variables are being set when docker creates container. I can see them accessible when I execute directly “docker exec” command but they are missing when use "Enter-PSSession -ContainerID"
I execute run command below
docker run -e "aadd=dds" -d microsoft/iis
And environment Variable is visible withing
docker exec -it 1c "powershell"
But if I use Enter-PSsession powershell cmdlet then that variable is missing

PS C:\Users\admin> Enter-PSSession -ContainerId (Get-Container 1c).ID
[1c86644e9350…]: PS C:\Users\ContainerUser\Documents> dir env:a*

> Name                           Value
> ----                           -----
> ALLUSERSPROFILE                C:\ProgramData
> APPDATA                        C:\Users\ContainerUser\AppData\Roaming