Skip to content

Docker IIS WindowsServerCore Image - Not able to read environment variable #75

Description

Hi Team,

We are setting environment variable like below in init.bat file.

When i do docker exec command to see inside containers i can see those environmental variable set but when IIS process(Asp.net) try to read, it doesn't find those. we are deploying containers via Service Fabric.
Below is sample docker file

FROM microsoft/iis:windowsservercore-ltsc2016
SHELL ["powershell"]

RUN Install-WindowsFeature NET-Framework-45-ASPNET ;
Install-WindowsFeature Web-Asp-Net45

CMD init.bat

COPY webContain webContain

RUN icacls "C:\webContain" /grant IIS_IUSRS:F /T

RUN Remove-WebSite -Name 'Default Web Site'

RUN New-Website -Name 'WebContainer' -Port 84
-PhysicalPath 'c:\webContain' -ApplicationPool '.NET v4.5'
EXPOSE 84

CMD Write-Host IIS Started... ;
while ($true) { Start-Sleep -Seconds 3600 }

Below are contents of init.cmd where we set environmental variables

setx /M PATH %PATH%;C:\sffabricbin
set PATH=%PATH%;C:\sffabricbin

Thanks,
Naresh Khatri

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions