Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

with own base image api is not starting anymore #498

Closed
LennartKleymann opened this issue Sep 7, 2023 · 7 comments
Closed

with own base image api is not starting anymore #498

LennartKleymann opened this issue Sep 7, 2023 · 7 comments

Comments

@LennartKleymann
Copy link

LennartKleymann commented Sep 7, 2023

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
Copy link
Member

baronfel commented Sep 7, 2023

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

@LennartKleymann
Copy link
Author

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

@baronfel
Copy link
Member

baronfel commented Sep 7, 2023

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
Copy link
Author

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
Copy link
Member

baronfel commented Sep 8, 2023

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:

  • the base image is targeted to arm64 in Docker terms
  • the application is targeting linux-x64 in .NET terms, which is amd64 in Docker terms

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

  • change the architecture of your base image to support linux-x64 applications:
    • either only build an amd64 version of your base image, or
    • create a docker manifest version of your base image - i.e. an image that points to different architecture-specific images. This is what the .NET images do.
  • publish your application for linux-arm64 - the SDK Container tooling supports this by adhering to the -r runtime selection CLI option

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
Copy link
Member

baronfel commented Sep 8, 2023

@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
Copy link
Author

@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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants