Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. Help with Docker

Help with Docker

Scheduled Pinned Locked Moved C#
asp-netdockerhelpcsharpdatabase
5 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • pkfoxP Offline
    pkfoxP Offline
    pkfox
    wrote on last edited by
    #1

    Hi all, I'm dipping my toes into the world of Docker and thought as part of my learning curve I'd try and containerize a recent net core api project. I've written a Dockerfile which seems to build the image ok but fails when I try running it with a file not found error. Any ideas guys ? This is only the beginning as the API makes calls to a postgresql database but the Docker way seems to be layered so I thought I'd start with the API first - am I correct doing it this way ? Docker file

    FROM mcr.microsoft.com/dotnet/core/sdk:3.1 AS build-env
    WORKDIR /app
    COPY . ./
    RUN dotnet publish -c Release -o out
    FROM mcr.microsoft.com/dotnet/core/aspnet:3.1
    COPY --from=build-env /app/out .
    ENTRYPOINT ["dotnet", "MyAPI.dll"]

    "I didn't mention the bats - he'd see them soon enough" - Hunter S Thompson - RIP

    L 1 Reply Last reply
    0
    • pkfoxP pkfox

      Hi all, I'm dipping my toes into the world of Docker and thought as part of my learning curve I'd try and containerize a recent net core api project. I've written a Dockerfile which seems to build the image ok but fails when I try running it with a file not found error. Any ideas guys ? This is only the beginning as the API makes calls to a postgresql database but the Docker way seems to be layered so I thought I'd start with the API first - am I correct doing it this way ? Docker file

      FROM mcr.microsoft.com/dotnet/core/sdk:3.1 AS build-env
      WORKDIR /app
      COPY . ./
      RUN dotnet publish -c Release -o out
      FROM mcr.microsoft.com/dotnet/core/aspnet:3.1
      COPY --from=build-env /app/out .
      ENTRYPOINT ["dotnet", "MyAPI.dll"]

      "I didn't mention the bats - he'd see them soon enough" - Hunter S Thompson - RIP

      L Offline
      L Offline
      Lost User
      wrote on last edited by
      #2

      Did the file "not found" have a name?

      It was only in wine that he laid down no limit for himself, but he did not allow himself to be confused by it. ― Confucian Analects: Rules of Confucius about his food

      pkfoxP 1 Reply Last reply
      0
      • L Lost User

        Did the file "not found" have a name?

        It was only in wine that he laid down no limit for himself, but he did not allow himself to be confused by it. ― Confucian Analects: Rules of Confucius about his food

        pkfoxP Offline
        pkfoxP Offline
        pkfox
        wrote on last edited by
        #3

        Yes my API assembly name

        "I didn't mention the bats - he'd see them soon enough" - Hunter S Thompson - RIP

        P 1 Reply Last reply
        0
        • pkfoxP pkfox

          Yes my API assembly name

          "I didn't mention the bats - he'd see them soon enough" - Hunter S Thompson - RIP

          P Offline
          P Offline
          Pete OHanlon
          wrote on last edited by
          #4

          I suspect that your build has actually gone into the app/out folder rather than the app folder.

          Advanced TypeScript Programming Projects

          pkfoxP 1 Reply Last reply
          0
          • P Pete OHanlon

            I suspect that your build has actually gone into the app/out folder rather than the app folder.

            Advanced TypeScript Programming Projects

            pkfoxP Offline
            pkfoxP Offline
            pkfox
            wrote on last edited by
            #5

            Thanks Pete what can I do to change that ? Edit I managed to suss it I out think, well it runs

            Get Base Image (Full .NET Core SDK)
            FROM mcr.microsoft.com/dotnet/core/sdk:3.1 AS build-env
            WORKDIR /app

            Copy csproj and restore
            COPY *.csproj ./
            RUN dotnet restore

            Copy everything else and build
            COPY . ./
            RUN dotnet publish -c Release -o out

            Generate runtime image
            FROM mcr.microsoft.com/dotnet/core/aspnet:3.1
            WORKDIR /app
            COPY --from=build-env /app/out .
            ENTRYPOINT ["dotnet", "AllValvesAPI.dll"]

            "I didn't mention the bats - he'd see them soon enough" - Hunter S Thompson - RIP

            1 Reply Last reply
            0
            Reply
            • Reply as topic
            Log in to reply
            • Oldest to Newest
            • Newest to Oldest
            • Most Votes


            • Login

            • Don't have an account? Register

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • World
            • Users
            • Groups