docker-archive / communitytools-image2docker-win

304 stars 78 forks source link

The container operating system does not match the host operating system. #81

Open sanchetanparmar opened 4 years ago

sanchetanparmar commented 4 years ago

After installation, running following commands

ConvertTo-Dockerfile -Local -OutputPath c:\docker_repo\iis -Artifact IIS -Verbose will generate Dockerfile

OS - Windows-2016DC Enabled - Install-WindowsFeature -Name Hyper-V

# escape=`
FROM microsoft/aspnet:3.5-windowsservercore-10.0.14393.1715
SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"]

RUN Remove-Website 'Default Web Site';

# Set up website: test
RUN New-Item -Path 'C:\inetpub\Publish\Publish\' -Type Directory -Force; 

RUN New-Website -Name 'test' -PhysicalPath 'C:\inetpub\Publish\Publish\' -Port 80 -ApplicationPool '.NET v2.0' -Force; 

EXPOSE 80

COPY ["Publish", "/inetpub/Publish/Publish/"]

RUN $path='C:\inetpub\Publish\Publish\'; `
    $acl = Get-Acl $path; `
    $newOwner = [System.Security.Principal.NTAccount]('BUILTIN\IIS_IUSRS'); `
    $acl.SetOwner($newOwner); `
    dir -r $path | Set-Acl -aclobject  $acl

but when i run docker build -t -t mywebsite . getting below errors

hcsshim::CreateComputeSystem 15f2c7d3 : The container operating system does not match the host operating system.

if i changed - FROM mcr.microsoft.com/dotnet/framework/aspnet:3.5

image build successful but when access container - 404 - File or directory not found. The resource you are looking for might have been removed, had its name changed, or is temporarily unavailable.