Missing DLL in docker image after copying published tree inside
I am currently experimenting with using JIB for packaging and deploying a dotnet project not written by me (I am not very familiar with dotnet).
I have the dotnet SDK installed (and visual studio 19) on my windows machine and after invoking "dotnet publish -c Release" on my solution which contain a project X and a test project X_test I end up with a bin/Release/netcoreapp2.1\publish folder.
In here I can run "dotnet X.dll" and the application starts.
Now I want to deploy said published folder to a docker image. My first attempt was using
mcr.microsoft.com/dotnet/core/runtime:2.1 which caused
It was not possible to find any compatible framework version The specified framework 'Microsoft.AspNetCore.App', version '2.1.1' was not found. - Check application dependencies and target a framework version installed at: /usr/share/dotnet/ - Installing .NET Core prerequisites might help resolve this problem: https://go.microsoft.com/fwlink/?LinkID=798306&clcid=0x409 - The .NET Core framework and SDK can be installed from: https://aka.ms/dotnet-download
I then tried using
mcr.microsoft.com/dotnet/core/aspnet:2.1 which gave
C:\Users\m86194\git\microsvc-operational-information>docker run -it operational-information-ms:0.0.1-SNAPSHOT bash Error: An assembly specified in the application dependencies manifest (Operational_Information.deps.json) was not found: package: 'Elasticsearch.Net', version: '6.0.0' path: 'lib/netstandard1.3/Elasticsearch.Net.dll'
There is an "Elasticsearch.Net.dll" file in the root of
bin\Release\netcoreapp21\publish folder, but not elsewhere.
I believe there is something about the build process I am missing.
Try doing a
dotnet restore before executing the publish command. Alternatively, you can use a multi stage docker build. See https://docs.docker.com/engine/examples/dotnetcore/ (mind the aspnet core version)
COPY / The system cannot find the file specified. � Issue #34893 , I can't build image Always this error, and if I call docker-compose same. ENTRYPOINT ["dotnet", "docker-example.dll"] RUN apk add --no-cache tree WORKDIR /app COPY obj/Docker/publish . ADD and COPY can only use files that are within the build-context; when starting a build, the docker cli� You could try logging into the VM (docker-machine ssh default) and check if the /var/lib/docker directory contains directories for other storage drivers (e.g. if there's an overlay driver there); that could explain your containers/images not being there if you happened to use the overlay driver before
I had the same problem with Asp.Net Core 3 and since I'm neither well versed in Docker nor the .Net build system, I used the default Dockerfile Visual Studio creates.
FROM mcr.microsoft.com/dotnet/core/aspnet:3.1-buster-slim AS base WORKDIR /app EXPOSE 80 EXPOSE 443 FROM mcr.microsoft.com/dotnet/core/sdk:3.1-buster AS build WORKDIR /src COPY ["Application/Application.csproj", "Application/"] COPY ["Dependency1/Dependency1.csproj", "Dependency1/"] RUN dotnet restore "Application/Application.csproj" COPY . . WORKDIR "/src/Application" RUN dotnet build "Application.csproj" -c Release -o /app/build FROM build AS publish RUN dotnet publish "Application.csproj" -c Release -o /app/publish FROM base AS final WORKDIR /app COPY --from=publish /app/publish . ENTRYPOINT ["dotnet", "application.dll"]
By default it only runs
dotnet restore for the main application. After adding the same for the dependent projects, it works.
FROM mcr.microsoft.com/dotnet/core/aspnet:3.1-buster-slim AS base WORKDIR /app EXPOSE 80 EXPOSE 443 FROM mcr.microsoft.com/dotnet/core/sdk:3.1-buster AS build WORKDIR /src COPY ["Application/Application.csproj", "Application/"] COPY ["Dependency1/Dependency1.csproj", "Dependency1/"] RUN dotnet restore "Dependency1/Dependency1.csproj" <-- this one is new RUN dotnet restore "Application/Application.csproj" COPY . . WORKDIR "/src/Application" RUN dotnet build "Application.csproj" -c Release -o /app/build FROM build AS publish RUN dotnet publish "Application.csproj" -c Release -o /app/publish FROM base AS final WORKDIR /app COPY --from=publish /app/publish . ENTRYPOINT ["dotnet", "application.dll"]
published application is missing assembly (missing runtime store , I am using the docker image dotnet:2.0-runtime to deploy for an asp.netcore 2.0 However I'm seeing this error when I run dotnet xxx.dll. Error: Description I've just updated to 1.13.0 by clicking on the Install now button (or whatever it is called exactly) in the New Docker version available pop-up window. When Docker was back to Docker is running, all volumes were gone along with the containers and images.
Turned out that I had made a mistake when specifying the docker file deployment.
Instead of using
bin\Release\netcoreapp21\publish I used
bin\Release\netcoreapp21\ which also has an X.dll along the
publish folder but gave the error. Changing to use the
publish folder instead, solved the problem.
Development workflow for Docker apps, You usually build a custom image for your container on top of a base image you get line with ["dotnet", "MySingleContainerWebApp.dll"] tells Docker to run a . It's not an OS, but you can think of it like "the" OS inside the container. Use a base, small, runtime-only image and copy the publishing folder� $ docker images --digests alpine:3.6 REPOSITORY TAG DIGEST IMAGE ID CREATED SIZE alpine 3.6 <none> 76da55c8019d 12 months ago 3.97 MB Copy link Quote reply vikas027 commented Oct 30, 2018
Containerize an app with Docker tutorial, Docker. Your folder tree will look like the following: Copy. docker-working Any parameters after -- are not passed to the dotnet run command and instead are passed to your application. NET Core app to the Docker image, first it must be published. Docker.dll -a---- 4/27/2020 8:27 AM 171520 NetCore. I have been running a few sites inside containers on an Azure VM, but and the images/containers are gone after a host reboot. Any idea what could be wrong or how I could retrieve the data?
Why is Docker-compose failing to copy local files to the container , From https://docs.docker.com/engine/reference/builder/#copy. says : COPY obeys the following rules: The [src] path must be inside the context of the build; you� Note you can still get the size of images (in docker images), and even a summary view taking into account shared layers (docker system df). Utilizing the content-hash with the image name can also improve your space requirements since you know that each build using a particular content hash are exactly the same.
asp net core mvc related issues & queries in StackoverflowXchanger.NET Core 3.1 - EntityFrameworkCore - DBContext.Query obsolete c# entity-framework-core.net-core-3.1
- Share us your current dockerfile. Have you copied the
publishfolder to docker image? Share us your csproj content.
- @TaoZhou Unfortunately I am not able to share the problematic project. I will try to make a sample project to replicate the behavoir. JIB does not use Docker but builds the docker image directly (this is what we are going for). I copy the bin/Release folder to the docker image so the path is
/netcoreapp2.1/publishin the resulting docker container. ElasticSearch.dll is used by one of our inhouse modules.