microsoft / dotnet-framework-docker

The repo for the official docker images for .NET Framework on Windows Server Core.
https://hub.docker.com/_/microsoft-dotnet-framework
MIT License
692 stars 332 forks source link

New-IISSiteBinding command not present in latest mcr.microsoft.com/dotnet/framework/wcf:4.8 #1096

Closed arindamnayak closed 6 months ago

arindamnayak commented 8 months ago

Describe the Bug

While using New-IISSiteBinding within Dockerfile with base image as mcr.microsoft.com/dotnet/framework/wcf:4.8, it says command not found.

New-IISSiteBinding : The term 'New-IISSiteBinding' is not recognized as the
name of a cmdlet, function, script file, or operable program. Check the
spelling of the name, or if a path was included, verify that the path is
correct and try again.
At line:1 char:76
+ ...  $ProgressPreference = 'SilentlyContinue'; New-IISSiteBinding -Name s ...
+                                                ~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : ObjectNotFound: (New-IISSiteBinding:String) [],
   ParentContainsErrorRecordException
    + FullyQualifiedErrorId : CommandNotFoundException

Whereas this was working with earlier images e.g. http://mcr.microsoft.com/dotnet/framework/wcf:4.8-20230214-windowsservercore-ltsc2019

Steps to Reproduce

Use mcr.microsoft.com/dotnet/framework/wcf:4.8 as docker image , then do docker run {IMAGE_ID} then run docker exec -it {container_id} "powershell" inside the powershell run New-IISSiteBinding, it says the above error. Whereas with older version, it was working fine.

Other Information

Output of docker version

Client:
 Cloud integration: v1.0.35+desktop.5
 Version:           24.0.6
 API version:       1.43
 Go version:        go1.20.7
 Git commit:        ed223bc
 Built:             Mon Sep  4 12:32:48 2023
 OS/Arch:           windows/amd64
 Context:           default

Server: Docker Desktop 4.24.2 (124339)
 Engine:
  Version:          24.0.6
  API version:      1.43 (minimum version 1.24)
  Go version:       go1.20.7
  Git commit:       1a79695
  Built:            Mon Sep  4 12:31:39 2023
  OS/Arch:          windows/amd64
  Experimental:     false

Output of docker info

Client:
 Version:    24.0.6
 Context:    default
 Debug Mode: false
 Plugins:
  buildx: Docker Buildx (Docker Inc.)
    Version:  v0.11.2-desktop.5
    Path:     C:\Program Files\Docker\cli-plugins\docker-buildx.exe
  compose: Docker Compose (Docker Inc.)
    Version:  v2.22.0-desktop.2
    Path:     C:\Program Files\Docker\cli-plugins\docker-compose.exe
  dev: Docker Dev Environments (Docker Inc.)
    Version:  v0.1.0
    Path:     C:\Program Files\Docker\cli-plugins\docker-dev.exe
  extension: Manages Docker extensions (Docker Inc.)
    Version:  v0.2.20
    Path:     C:\Program Files\Docker\cli-plugins\docker-extension.exe
  init: Creates Docker-related starter files for your project (Docker Inc.)
    Version:  v0.1.0-beta.8
    Path:     C:\Program Files\Docker\cli-plugins\docker-init.exe
  sbom: View the packaged-based Software Bill Of Materials (SBOM) for an image (Anchore Inc.)
    Version:  0.6.0
    Path:     C:\Program Files\Docker\cli-plugins\docker-sbom.exe
  scan: Docker Scan (Docker Inc.)
    Version:  v0.26.0
    Path:     C:\Program Files\Docker\cli-plugins\docker-scan.exe
  scout: Docker Scout (Docker Inc.)
    Version:  v1.0.7
    Path:     C:\Program Files\Docker\cli-plugins\docker-scout.exe

Server:
 Containers: 13
  Running: 0
  Paused: 0
  Stopped: 13
 Images: 24
 Server Version: 24.0.6
 Storage Driver: windowsfilter
  Windows: 
 Logging Driver: json-file
 Plugins:
  Volume: local
  Network: ics internal l2bridge l2tunnel nat null overlay private transparent
  Log: awslogs etwlogs fluentd gcplogs gelf json-file local logentries splunk syslog
 Swarm: inactive
 Default Isolation: hyperv
 Operating System: Microsoft Windows 
 OSType: windows
 Architecture: x86_64
 CPUs: 6
 Total Memory: 32GiB
 Docker Root Dir: C:\ProgramData\Docker
 Debug Mode: false
 Experimental: false
Live Restore Enabled: false
 Product License: Community Engine
lbussell commented 8 months ago

[Triage] @John-Hart can you please take a look at this?

John-Hart commented 8 months ago

@arindamnayak do you know what the OS Version is that you pulled?

Since 4.8 is a multi-arch tag you could have pulled ltsc2106 which is version 14393 and it contains IISAdministration module version 1.0. The New-IISSiteBinding was introduced in 1.1 which explains why you see it when you pulled http://mcr.microsoft.com/dotnet/framework/wcf:4.8-20230214-windowsservercore-ltsc2019.

arindamnayak commented 8 months ago

@John-Hart , I pulled for arch 2019 , and based os version where this is being used is 2019 only,

John-Hart commented 8 months ago

@arindamnayak can you try pulling the ltsc2019 image 4.8-20231010-windowsservercore-ltsc2019 to make sure?

arindamnayak commented 8 months ago

@John-Hart , with that tag 4.8-20231010-windowsservercore-ltsc2019, it is working fine.

lbussell commented 7 months ago

@arindamnayak, is the issue resolved on your end?

To investigate further, you can check the Windows version that's being pulled using the multi-platform tag by running the container:

CMD> ver

Microsoft Windows [Version 10.0.22631.2715]

CMD> docker run --rm --entrypoint cmd mcr.microsoft.com/dotnet/framework/wcf:4.8

Microsoft Windows [Version 10.0.14393]
(c) 2016 Microsoft Corporation. All rights reserved.

Running a Windows 11 host (version > 22000) will pull a Server 2016 image due to https://github.com/containerd/containerd/issues/6508. For that reason it's recommended to always explicitly pull the operating system version you want when using Windows containers.

lbussell commented 6 months ago

[Triage] Closing as there was no response and @arindamnayak stated that "it [was] working fine".