I'm trying to asign the result of a powershell command to MY_VAR
environment variable. I have tried several ways but I cannot get the variable to take the value of the operation. If I assign the variable as follows what I get as a value is the command literally.
ARG MY_ARG="VALUE"
ENV MY_VAR=[Convert]::ToBase64String([system.Text.Encoding]::UTF8.GetBytes($MY_ARG))
ENV MY_VAR2=$([Convert]::ToBase64String([system.Text.Encoding]::UTF8.GetBytes($MY_ARG)))
When I check the values into the container I get this:
Get-Childitem -Path Env:MY_VAR*
Name Value
---- -----
MY_VAR [Convert]::ToBase64String([system.Text.Encoding]::UTF8.GetBytes(VALUE))
MY_VAR2 $([Convert]::ToBase64String([system.Text.Encoding]::UTF8.GetBytes(VALUE)))
The base of my containers are Windows Server Core and my shell is powershell.