I'm trying to use same dockerfile to build the images ltsc2016 and ltsc2019, but i'm stuck on the appcmd command.
For ltsc2016 only works if quotes are '
:
RUN c:\windows\system32\inetsrv\appcmd set app 'Default Web Site/' /enabledProtocols:"http"
If i change to double quotes:
RUN c:\windows\system32\inetsrv\appcmd set app "Default Web Site/" /enabledProtocols:"http"
Failed to process input: The parameter 'Web' must begin with a / or - (HRESULT=80070057).
For image ltsc2019 only works if images are "
:
RUN c:\windows\system32\inetsrv\appcmd set app "Default Web Site/" /enabledProtocols:"http"
But if i set equal to ltsc2019 i get:
to process input: The parameter 'Web' must begin with a / or - (HRESULT=80070057).
Odd thing, enabledProtocols works fine in both images using same character for quote.
This looks like a bug on appcmd.exe but i haven't be able to circumvent it.
Any ideas?
The dockerfile:
# escape=`
#from ms samples https://github.com/microsoft/dotnet-framework-docker/blob/main/src/wcf/4.8/windowsservercore-ltsc2022/Dockerfile
ARG REPO=mcr.microsoft.com/dotnet/framework/aspnet
ARG OS_VERSION=ltsc2022
FROM $REPO:4.8-windowsservercore-${OS_VERSION}
# Install Windows components required for WCF service hosted on IIS
RUN dism /Online /Quiet /Enable-Feature /All /FeatureName:WCF-HTTP-Activation45 /FeatureName:WCF-TCP-Activation45 /FeatureName:IIS-WebSockets /FeatureName:IIS-BasicAuthentication
# Enable net.tcp protocol for default web site on IIS
RUN c:\windows\system32\inetsrv\appcmd set app "Default Web Site/" /enabledProtocols:"http"
EXPOSE 80
WORKDIR C:\inetpub\wwwroot
COPY . .
@mklement0
gave the right pointer, the command was executed with cmd.exe
on one image and with powershell
on other and that was causing the different behavior regarding quotes.
So, just had to force RUN
command to use powershell
always, by adding the following command at start:
SHELL ["powershell", "-Command"]
The complete dockerfile:
# escape=`
#from ms samples https://github.com/microsoft/dotnet-framework-docker/blob/main/src/wcf/4.8/windowsservercore-ltsc2022/Dockerfile
ARG REPO=mcr.microsoft.com/dotnet/framework/aspnet
ARG OS_VERSION=ltsc2022
FROM $REPO:4.8-windowsservercore-${OS_VERSION}
#force the use of powershell on all builds
SHELL ["powershell", "-Command"]
# Install Windows components required for WCF service hosted on IIS
RUN dism /Online /Quiet /Enable-Feature /All /FeatureName:WCF-HTTP-Activation45 /FeatureName:WCF-TCP-Activation45 /FeatureName:IIS-WebSockets /FeatureName:IIS-BasicAuthentication
# Enable net.tcp protocol for default web site on IIS
RUN c:\windows\system32\inetsrv\appcmd set app "Default Web Site/" /enabledProtocols:"http"
EXPOSE 80
WORKDIR C:\inetpub\wwwroot
COPY . .