Accessing Container Environment Variables using Sitecore PowerShell Extensions

Wednesday, October 12, 2022

Accessing Container Environment Variables

I recently had an issue where I needed to debug a Sitecore instance running in a Docker container. I needed to access the environment variables of the container, but didn't have access to the cluster to see the values. So I had to figure out a way to list out the variables that had been used to setup the container, enter Sitecore PowerShell Extensions (SPE).

SPE to the rescue!

I turns out that having access to run SPE scripts made this super easy. At first the ouput was being truncated which wasn't much use, but after a few tweaks I was able to get the output I needed with the following command:

gci env: | Format-Table -Wrap -AutoSize

Hope that helps anyone else who needs to find out the values for the environment variables powering a Sitecore container, when you don't have access to the back end!