Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

StackOverflow Point

StackOverflow Point Navigation

  • Web Stories
  • Badges
  • Tags
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Web Stories
  • Badges
  • Tags
Home/ Questions/Q 4285
Alex Hales
  • 0
Alex HalesTeacher
Asked: June 3, 20222022-06-03T16:32:26+00:00 2022-06-03T16:32:26+00:00

c# – Why is my certificate store missing when I debug my .net core app (linux container) in Visual Studio vs when using docker-compose up command?

  • 0

[ad_1]

I have a project that I want to debug. I have a use case where I must access a couple of different certs from the CurrentUser.My trust store. I know that linux maps the cert store differently than windows and each distro maps it differently. I also know that the CurrentUser.My store location is supported in linux.

When I execute docker-compose up -d my container’s root folder looks as follows.
[![root folder contains dotnet directory as expected][1]][1]

When I run the container using Visual Studio’s debugger for docker-compose my containers root folder looks as follows.
[![Container Root Folder when container is created when debugging in Visual Studio][2]][2]

I can’t figure out why the .dotnet folder is not created within the root directory of the container when I try to debug. Can anyone help me. I’m learning docker and i’ve been trying to figure out why the root container is different for a couple of days. Any guidance or feedback would be greatly appreciated.

Here are my compose files for reference.

docker-compose.yml


FROM mcr.microsoft.com/dotnet/aspnet:6.0 AS base
WORKDIR /app
RUN apt-get update && apt-get install -y libgdiplus && apt-get install -y nano && apt-get -y install tzdata
COPY ["localcontainercert.pfx", "/etc/ssl/certs/localcontainercert.pfx"]
COPY ["PublicCert.pfx", "/etc/ssl/certs/PublicCert.pfx"]
COPY ["localcontainercert.crt", "/usr/local/share/ca-certificates/localcontainercert.crt"]
RUN chmod 644 /usr/local/share/ca-certificates/localcontainercert.crt 
RUN update-ca-certificates

EXPOSE 44360
EXPOSE 44390

FROM mcr.microsoft.com/dotnet/sdk:6.0 AS build
WORKDIR /certtool
# Install certificate tool
RUN dotnet tool install --tool-path ./ dotnet-certificate-tool

WORKDIR /src
COPY ["NuGet.Config", "."]
COPY ["src/SampleApp.Web/SampleApp.Web.csproj", "src/SampleApp.Web/"]
COPY ["src/SampleApp.EntityFrameworkCore.DbMigrations/SampleApp.EntityFrameworkCore.DbMigrations.csproj", "src/SampleApp.EntityFrameworkCore.DbMigrations/"]
COPY ["src/SampleApp.EntityFrameworkCore/SampleApp.EntityFrameworkCore.csproj", "src/SampleApp.EntityFrameworkCore/"]
COPY ["src/SampleApp.Domain/SampleApp.Domain.csproj", "src/SampleApp.Domain/"]
COPY ["src/SampleApp.Domain.Shared/SampleApp.Domain.Shared.csproj", "src/SampleApp.Domain.Shared/"]
COPY ["src/SampleApp.HttpApi/SampleApp.HttpApi.csproj", "src/SampleApp.HttpApi/"]
COPY ["src/SampleApp.Application.Contracts/SampleApp.Application.Contracts.csproj", "src/SampleApp.Application.Contracts/"]
COPY ["src/SampleApp.Application/SampleApp.Application.csproj", "src/SampleApp.Application/"]
RUN dotnet restore "src/SampleApp.Web/SampleApp.Web.csproj"
COPY . .
WORKDIR "/src/src/SampleApp.Web"
RUN dotnet build "SampleApp.Web.csproj" -c Release -o /app/build

FROM build AS publish
RUN dotnet publish "SampleApp.Web.csproj" -c Release -o /app/publish

FROM base AS final
WORKDIR /app
#Copy published app to base
COPY --from=publish /app/publish .

# Install certificates & Required Libraries
COPY --from=build /certtool .
RUN ./certificate-tool add --file /etc/ssl/certs/localcontainercert.pfx --password 'password'
RUN ./certificate-tool add --file /etc/ssl/certs/PublicCert.pfx --password 'password'

WORKDIR /app
ENTRYPOINT ["dotnet", "SampleApp.Web.dll"]```

docker-compose.vs.debug.yml
```version: '3.4'

services:
  SampleApp.kiosk:
    build:
      target: base
      labels:
        com.microsoft.created-by: "visual-studio"
        com.microsoft.visual-studio.project-name: "SampleApp.Kiosk"
    environment:
      - DOTNET_USE_POLLING_FILE_WATCHER=1
      - ASPNETCORE_LOGGING__CONSOLE__DISABLECOLORS=true
      - NUGET_FALLBACK_PACKAGES=
    volumes:
      - D:\Workspace\SampleApp\aspnet-core\src\SampleApp.Kiosk:/app
      - D:\Workspace\SampleApp\aspnet-core:/src
      - C:\Users\UserName\vsdbg\vs2017u5:/remote_debugger:rw
      - C:\Users\UserName\.nuget\packages\:/root/.nuget/packages:ro
      #- ${APPDATA}/ASP.NET/Https:/root/.aspnet/https:ro
      #- ${APPDATA}/Microsoft/UserSecrets:/root/.microsoft/usersecrets:ro

    entrypoint: tail -f /dev/null
    labels:
      com.microsoft.visualstudio.debuggee.program: "dotnet"
      com.microsoft.visualstudio.debuggee.arguments: " --additionalProbingPath /root/.nuget/packages  \"/app/bin/Debug/net6.0/SampleApp.Kiosk.dll\""
      com.microsoft.visualstudio.debuggee.workingdirectory: "/app"
      com.microsoft.visualstudio.debuggee.killprogram: "/bin/sh -c \"if PID=$$(pidof dotnet); then kill $$PID; fi\""
    tty: true
  SampleApp.web:
    #image: jarrad78SampleApp/SampleApp-web:dev
    build:
      target: base
      labels:
        com.microsoft.created-by: "visual-studio"
        com.microsoft.visual-studio.project-name: "SampleApp.Web"
    environment:
      - DOTNET_USE_POLLING_FILE_WATCHER=1
      - ASPNETCORE_LOGGING__CONSOLE__DISABLECOLORS=true
      - NUGET_FALLBACK_PACKAGES=
    volumes:
      - D:\Workspace\SampleApp\aspnet-core\src\SampleApp.Web:/app
      - D:\Workspace\SampleApp\aspnet-core:/src
      - C:\Users\UserName\vsdbg\vs2017u5:/remote_debugger:rw
      #- C:\Users\UserName\.nuget\packages\:/root/.nuget/packages:ro
      #- ${APPDATA}/ASP.NET/Https:/root/.aspnet/https:ro
      #- ${APPDATA}/Microsoft/UserSecrets:/root/.microsoft/usersecrets:ro

    entrypoint: tail -f /dev/null
    labels:
      com.microsoft.visualstudio.debuggee.program: "dotnet"
      com.microsoft.visualstudio.debuggee.arguments: " --additionalProbingPath /root/.nuget/packages  \"/app/bin/Debug/net6.0/SampleApp.Web.dll\""
      com.microsoft.visualstudio.debuggee.workingdirectory: "/app"
      com.microsoft.visualstudio.debuggee.killprogram: "/bin/sh -c \"if PID=$$(pidof dotnet); then kill $$PID; fi\""
    tty: true```


  [1]: https://i.stack.imgur.com/WY9g9.png
  [2]: https://i.stack.imgur.com/YrKr5.png

[ad_2]

  • 0 0 Answers
  • 6 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report
Leave an answer

Leave an answer
Cancel reply

Browse

Sidebar

Ask A Question

Related Questions

  • xcode - Can you build dynamic libraries for iOS and ...

    • 0 Answers
  • bash - How to check if a process id (PID) ...

    • 8037 Answers
  • database - Oracle: Changing VARCHAR2 column to CLOB

    • 1840 Answers
  • What's the difference between HEAD, working tree and index, in ...

    • 1918 Answers
  • Amazon EC2 Free tier - how many instances can I ...

    • 0 Answers

Stats

  • Questions : 43k

Subscribe

Login

Forgot Password?

Footer

Follow

© 2022 Stackoverflow Point. All Rights Reserved.

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.