0

I'm currently redefining our build pipeline and build our sources by using the VM image windows-latest which currently resolves to Hosted Windows 2019 with VS2019.

After calling publish I get my desired sources into the specified output directory. There I simply add our dockerfile which is as easy as

FROM mcr.microsoft.com/dotnet/core/aspnet:2.2 as base
WORKDIR /app
EXPOSE 80
COPY . .
ENTRYPOINT ["dotnet", "myStarting.dll"]

The next step within the pipeline is build and push the docker container, which is defined as this:

- task: Docker@0
  displayName: 'Build Docker Image'
  inputs:
    azureSubscription: '$(azureContainerSubscription)'
    azureContainerRegistry: $(azureContainerRegistry)
    dockerFile: '$(Build.ArtifactStagingDirectory)/Dockerfile'
    defaultContext: false
    context: .
    imageName: 'myImage:$(Build.BuildId)'
    includeLatestTag: true

- task: Docker@0
  displayName: 'Push Docker Image'
  inputs:
    azureSubscription: '$(azureContainerSubscription)'
    azureContainerRegistry: $(azureContainerRegistry)
    action: 'Push an image'
    imageName: 'myImage:$(Build.BuildId)'
    includeLatestTag: true

So far everything is fine and the container is available. Unfortunately when I try to start that container in our Azure K8 cluster I get the following error message:

image operating system "windows" cannot be used on this platform

After checking within the Azure portal our container repository, I can see that the docker image was created for the platform windows / amd64.

So how can I configure my docker task to build for the linux platform? After checking the base image on docker hub I tried to use another tag, like 2.2-stretch-slim, but it just gave out the error message:

image operating system "linux" cannot be used on this platform

So how can I build my solution and put my published files into a linux container?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.