cent os docker error: aspdonet .csproj
While try to build dotnet container in linux centos, facing below mentioned issue
##docker build -t dockertest . Sending build context to Docker daemon 3.093MB Step 1/17 : FROM microsoft/dotnet:2.1-aspnetcore-runtime AS base ---> 1fe6774e5e9e Step 2/17 : WORKDIR /app ---> Using cache ---> 06b527e7b54c Step 3/17 : EXPOSE 50223 ---> Using cache ---> 328d5ed190c8 Step 4/17 : EXPOSE 44349 ---> Using cache ---> 078c776b3b8b Step 5/17 : FROM microsoft/dotnet:2.1-sdk AS build ---> 6baac5bd0ea2 Step 6/17 : WORKDIR /src ---> Using cache ---> 476ee27f3e06 Step 7/17 : COPY "dockertest/dockertest.csproj", "dockertest/" COPY failed: stat /var/lib/docker/tmp/docker-builder798058264/dockertest/dockert
Error : COPY failed: stat /var/lib/docker/tmp/docker-builder798058264/dockertest/dockert est.csproj,: no such file or directory
how to build dotnet container in linux centos docker?
Hi @arun1895, can you try in another distro to ensure it works in any? I'll try to follow up when I can.
Hi @arun1895 , can you try in another distro to ensure it works in any? I'll try to follow up when I can.
Thank you for your reply@Ralph Squillace ,i had tried with distro but facing the same issue, would you kindly help me out how to solve this issue?
below its my docker file
FROM microsoft/dotnet:2.1-aspnetcore-runtime AS base WORKDIR /app EXPOSE 50223 EXPOSE 44349
FROM microsoft/dotnet:2.1-sdk AS build WORKDIR /src COPY "dockertest/dockertest.csproj", "dockertest/" RUN dotnet restore "dockertest/dockertest.csproj" COPY . . WORKDIR "/src/dockertest" RUN dotnet build "dockertest.csproj" -c Release -o /app
FROM build AS publish RUN dotnet publish "dockertest.csproj" -c Release -o /app
FROM base AS final WORKDIR /app COPY --from=publish /app . ENTRYPOINT ["dotnet", "dockertest.dll"]
@arun1895 hmmmm. Is this the example dotnetcore app in the repo, or another one that you are using?
@arun1895 hmmmm. Is this the example dotnetcore app in the repo, or another one that you are using?
the same am using for the testing if it will be run successfully, then we proceed with our build projetcs.
so, example-dotnetcore in this repo has the following, which means your Dockerfile is your own. Correct?
FROM microsoft/dotnet:2.1-sdk AS builder
WORKDIR /app
# caches restore result by copying csproj file separately
COPY *.csproj .
RUN dotnet restore
COPY . .
RUN dotnet publish --output /app/ --configuration Release
RUN sed -n 's:.*<AssemblyName>\(.*\)</AssemblyName>.*:\1:p' *.csproj > __assemblyname
RUN if [ ! -s __assemblyname ]; then filename=$(ls *.csproj); echo ${filename%.*} > __assemblyname; fi
# Stage 2
FROM microsoft/dotnet:2.1-aspnetcore-runtime
WORKDIR /app
COPY --from=builder /app .
ENV PORT 80
EXPOSE 80
ENTRYPOINT dotnet $(cat /app/__assemblyname).dll
this is with Draft v. 0.16
this is with Draft v. 0.16
Yes we created own file for testing, so that we can run our very own webistes on docker
I strongly suggest you have a look at mapping your dockerfile to be closer to this one, until you figure out why you're copying a directory that doesn't exist -- it almost looks like the docker environment you're running in is broken -- or at least very, very different. The fact that your Dockerfile doesn't work on other distros strongly implies that your dockerfile is wrong, or the docker config.
I can help you with Draft itself, but when you create your own dockerfile, you're going to have to find a way to debug it yourself. :-(
Could you please share any aspnet core sample dockeer file , and how build it
I strongly suggest you have a look at mapping your dockerfile to be closer to this one, until you figure out why you're copying a directory that doesn't exist -- it almost looks like the docker environment you're running in is broken -- or at least very, very different. The fact that your Dockerfile doesn't work on other distros strongly implies that your dockerfile is wrong, or the docker config.
I can help you with Draft itself, but when you create your own dockerfile, you're going to have to find a way to debug it yourself. :-(
Could you please share any aspnet core sample dockeer file , and how build it
https://github.com/Azure/draft/issues/901#issuecomment-440662599. this is what Draft creates for the example-dotnetcore getting started application. Start with that.
@squillace @bacongobbler @jdhuntington @chad > #901 (comment). this is what Draft creates for the example-dotnetcore getting started application. Start with that.
docker build -t dockertest . Sending build context to Docker daemon 3.093MB Step 1/17 : FROM microsoft/dotnet:2.1-aspnetcore-runtime AS base ---> 1fe6774e5e9e Step 2/17 : WORKDIR /app ---> Using cache ---> 06b527e7b54c Step 3/17 : EXPOSE 50223 ---> Using cache ---> 43c352910ae8 Step 4/17 : EXPOSE 44349 ---> Using cache ---> 1e7d2e25f5f5 Step 5/17 : FROM microsoft/dotnet:2.1-sdk AS build ---> 6baac5bd0ea2 Step 6/17 : WORKDIR /src ---> Using cache ---> e797eddc6685 Step 7/17 : COPY *.csproj . ---> 3b5b68f32f10 Step 8/17 : RUN dotnet restore ---> Running in da873e307606 Restoring packages for /src/dockertest.csproj... /usr/share/dotnet/sdk/2.1.403/NuGet.targets(114,5): error : Unable to load the service index for source https://api.nuget.org/v3/index.json. [/src/dockertest.csproj] /usr/share/dotnet/sdk/2.1.403/NuGet.targets(114,5): error : Resource temporarily unavailable [/src/dockertest.csproj] The command '/bin/sh -c dotnet restore' returned a non-zero code: 1
Error : /usr/share/dotnet/sdk/2.1.403/NuGet.targets(114,5): error : Unable to load the service index for source https://api.nuget.org/v3/index.json. [/src/dockertest.csproj] /usr/share/dotnet/sdk/2.1.403/NuGet.targets(114,5): error : Resource temporarily unavailable [/src/dockertest.csproj] The command '/bin/sh -c dotnet restore' returned a non-zero code: 1
and my in dockertest folder i have this below mentioned files and folders
21 23:19 Dockerfile -rw-r--r--. 1 root root 471 Nov 13 02:41 dockertest.csproj -rw-r--r--. 1 root root 229508 Nov 13 13:19 dockertest.deps.json -rw-r--r--. 1 root root 9728 Nov 13 13:19 dockertest.dll -rw-r--r--. 1 root root 1680 Nov 13 13:19 dockertest.pdb -rw-r--r--. 1 root root 240 Nov 13 13:19 dockertest.runtimeconfig.dev.json -rw-r--r--. 1 root root 224 Nov 13 13:19 dockertest.runtimeconfig.json -rw-r--r--. 1 root root 77824 Nov 13 13:19 dockertest.Views.dll -rw-r--r--. 1 root root 5556 Nov 13 13:19 dockertest.Views.pdb drwxr-xr-x. 3 root root 264 Nov 13 05:20 publish