dotnet / sdk-container-builds

Libraries and build tooling to create container images from .NET projects using MSBuild
https://learn.microsoft.com/en-us/dotnet/core/docker/publish-as-container
MIT License
176 stars 30 forks source link

with own base image api is not starting anymore #498

Closed LennartKleymann closed 9 months ago

LennartKleymann commented 10 months ago

If i publish using this command: dotnet publish -c Release -p:ContainerBaseImage=registry-1.docker.io/kleymannl/dotnet-libfontconfig1:latest -p:ContainerImageName=replaced/replaced -p:RuntimeIdentifier=linux-x64

the container is not starting anymore and I get following error message: replaced.path: no such file or directory

My base image looks like this:

FROM mcr.microsoft.com/dotnet/runtime-deps:7.0
RUN apt-get update
RUN apt-get install -y libfontconfig1
baronfel commented 10 months ago

@LennartKleymann can you provide some more information, like an https://aka.ms/binlog of the publish step?

LennartKleymann commented 10 months ago

BinLog is a little bit complicated, because it contains sensitive data for me. Can I share it to you privately? @baronfel

baronfel commented 10 months ago

Sure! Create a new developer community ticket here, and once you've created the ticket you can upload the binlog privately to that site. Then you can comment back here with the link to the ticket you just created and I'll be able to securely access the binlog.

LennartKleymann commented 10 months ago

Okay thanks. I attached the binlog to a private comment for microsoft only. https://developercommunity.visualstudio.com/t/sdk-container-builds:-with-own-base-imag/10461318

baronfel commented 10 months ago

Hi @LennartKleymann - I took a look at your binlog (thank you!) and what I found is that your base image is for a different architecture than your packaged application:

as a result, the binaries built from your publish command are incompatible with your base image. You have two solutions here:

Separately, I'm going to log an issue against our tooling - when the base image is a single image (not a manifest list) we currently assume that the architectures match. We should actually verify this and error out, since the application will not be able to run in this scenario.

baronfel commented 10 months ago

@LennartKleymann can you take a look at this comment? This is what I'm hoping to get into .NET 8 that would identify and force you to handle this error case.

LennartKleymann commented 9 months ago

@baronfel Hey, sorry for the late response. With building my base image on the correct plattform my publsih of my API works.

I think that the comment you link is really good to prevent confusion, thank you really much.