Need assistance with Dockerfile and Kubernetes for .AspNetCore serviceWhat is the difference between CMD and ENTRYPOINT in a Dockerfile?What is the difference between the `COPY` and `ADD` commands in a Dockerfile?publish a web api based on asp.net core RC2 on dockerCan't start ASP.NET Core web API Docker on a specified porthow to create image of an angular 4 app setup inside asp.net core using dockerAspNetCore:2.1 not founddocker dotnet error while copying csproj fileDocker Copy Command failsCannot run Asp.Net core web api scaffolded application in docker?Error MSB3073 Exited With Code 1 and unable to load the service index for source index.json
Reverse dictionary where values are lists
How did the Super Star Destroyer Executor get destroyed exactly?
Watching something be piped to a file live with tail
Extract rows of a table, that include less than x NULLs
Forgetting the musical notes while performing in concert
Can I run a new neutral wire to repair a broken circuit?
Little known, relatively unlikely, but scientifically plausible, apocalyptic (or near apocalyptic) events
Is "remove commented out code" correct English?
Do UK voters know if their MP will be the Speaker of the House?
Size of subfigure fitting its content (tikzpicture)
Why doesn't using multiple commands with a || or && conditional work?
iPad being using in wall mount battery swollen
All in one piece, we mend holes in your socks
How do conventional missiles fly?
Avoiding the "not like other girls" trope?
What's the in-universe reasoning behind sorcerers needing material components?
Why no variance term in Bayesian logistic regression?
Personal Teleportation: From Rags to Riches
Expand and Contract
Intersection Puzzle
Plagiarism or not?
Why was the shrinking from 8″ made only to 5.25″ and not smaller (4″ or less)?
Can we compute the area of a quadrilateral with one right angle when we only know the lengths of any three sides?
Can a virus destroy the BIOS of a modern computer?
Need assistance with Dockerfile and Kubernetes for .AspNetCore service
What is the difference between CMD and ENTRYPOINT in a Dockerfile?What is the difference between the `COPY` and `ADD` commands in a Dockerfile?publish a web api based on asp.net core RC2 on dockerCan't start ASP.NET Core web API Docker on a specified porthow to create image of an angular 4 app setup inside asp.net core using dockerAspNetCore:2.1 not founddocker dotnet error while copying csproj fileDocker Copy Command failsCannot run Asp.Net core web api scaffolded application in docker?Error MSB3073 Exited With Code 1 and unable to load the service index for source index.json
My docker build is failing due to the following error:
COPY failed: CreateFile ?C:ProgramDataDockertmpdocker-builder117584470Aeros.Services.KubernetesAeros.Services.Kubernetes.csproj: The system cannot find the path specified.
I am fairly new to docker and have went with the basic project template that is set up when you create a Kubernetes container project template, so I'd figure it would work out of the box, but I'm mistaken.
I'm having problems trying to figure out what it's attempting to due in the temp directory structure and the reason it is failing. Can anyone offer some assistance? I've done some searching and others have said the default docker template was incorrect in Visual Studio, but I'm not seeing any of the files being copied over to the temp directory to begin with, so figuring out what is going on is being rather problematic at the time.
Here is the docker file, the only thing I've added is a publishingProfile arg so I can tell it which profile to use in the Build and Publish steps :
ARG publishingProfile
FROM microsoft/dotnet:2.1-aspnetcore-runtime AS base
WORKDIR /app
EXPOSE 80
FROM microsoft/dotnet:2.1-sdk AS build
WORKDIR /src
COPY ["Aeros.Services.Kubernetes/Aeros.Services.Kubernetes.csproj", "Aeros.Services.Kubernetes/"]
RUN dotnet restore "Aeros.Services.Kubernetes/Aeros.Services.Kubernetes.csproj"
COPY . ./
WORKDIR "/src/Aeros.Services.Kubernetes"
RUN dotnet build "Aeros.Services.Kubernetes.csproj" -c $publishingProfile -o /app
FROM build AS publish
RUN dotnet publish "Aeros.Services.Kubernetes.csproj" -c $publishingProfile -o /app
FROM base AS final
WORKDIR /app
COPY --from=publish /app .
ENTRYPOINT ["dotnet", "Aeros.Services.Kubernetes.dll"]
I haven't touched the yaml file, but if you need that I can provide it as well. Again, all I've done with this is add a few NuGet packages to the project reference. Build in VisualStudio runs fine, but the docker command:
docker build . --build-arg publishingProfile=Release
is failing with the error mentioned above.
Can someone be so kind as to offer some enlightenment? Thanks!
Edit 1:
I am executing this from the project's folder via a PowerShell command line.
visual-studio docker asp.net-core

add a comment |
My docker build is failing due to the following error:
COPY failed: CreateFile ?C:ProgramDataDockertmpdocker-builder117584470Aeros.Services.KubernetesAeros.Services.Kubernetes.csproj: The system cannot find the path specified.
I am fairly new to docker and have went with the basic project template that is set up when you create a Kubernetes container project template, so I'd figure it would work out of the box, but I'm mistaken.
I'm having problems trying to figure out what it's attempting to due in the temp directory structure and the reason it is failing. Can anyone offer some assistance? I've done some searching and others have said the default docker template was incorrect in Visual Studio, but I'm not seeing any of the files being copied over to the temp directory to begin with, so figuring out what is going on is being rather problematic at the time.
Here is the docker file, the only thing I've added is a publishingProfile arg so I can tell it which profile to use in the Build and Publish steps :
ARG publishingProfile
FROM microsoft/dotnet:2.1-aspnetcore-runtime AS base
WORKDIR /app
EXPOSE 80
FROM microsoft/dotnet:2.1-sdk AS build
WORKDIR /src
COPY ["Aeros.Services.Kubernetes/Aeros.Services.Kubernetes.csproj", "Aeros.Services.Kubernetes/"]
RUN dotnet restore "Aeros.Services.Kubernetes/Aeros.Services.Kubernetes.csproj"
COPY . ./
WORKDIR "/src/Aeros.Services.Kubernetes"
RUN dotnet build "Aeros.Services.Kubernetes.csproj" -c $publishingProfile -o /app
FROM build AS publish
RUN dotnet publish "Aeros.Services.Kubernetes.csproj" -c $publishingProfile -o /app
FROM base AS final
WORKDIR /app
COPY --from=publish /app .
ENTRYPOINT ["dotnet", "Aeros.Services.Kubernetes.dll"]
I haven't touched the yaml file, but if you need that I can provide it as well. Again, all I've done with this is add a few NuGet packages to the project reference. Build in VisualStudio runs fine, but the docker command:
docker build . --build-arg publishingProfile=Release
is failing with the error mentioned above.
Can someone be so kind as to offer some enlightenment? Thanks!
Edit 1:
I am executing this from the project's folder via a PowerShell command line.
visual-studio docker asp.net-core

add a comment |
My docker build is failing due to the following error:
COPY failed: CreateFile ?C:ProgramDataDockertmpdocker-builder117584470Aeros.Services.KubernetesAeros.Services.Kubernetes.csproj: The system cannot find the path specified.
I am fairly new to docker and have went with the basic project template that is set up when you create a Kubernetes container project template, so I'd figure it would work out of the box, but I'm mistaken.
I'm having problems trying to figure out what it's attempting to due in the temp directory structure and the reason it is failing. Can anyone offer some assistance? I've done some searching and others have said the default docker template was incorrect in Visual Studio, but I'm not seeing any of the files being copied over to the temp directory to begin with, so figuring out what is going on is being rather problematic at the time.
Here is the docker file, the only thing I've added is a publishingProfile arg so I can tell it which profile to use in the Build and Publish steps :
ARG publishingProfile
FROM microsoft/dotnet:2.1-aspnetcore-runtime AS base
WORKDIR /app
EXPOSE 80
FROM microsoft/dotnet:2.1-sdk AS build
WORKDIR /src
COPY ["Aeros.Services.Kubernetes/Aeros.Services.Kubernetes.csproj", "Aeros.Services.Kubernetes/"]
RUN dotnet restore "Aeros.Services.Kubernetes/Aeros.Services.Kubernetes.csproj"
COPY . ./
WORKDIR "/src/Aeros.Services.Kubernetes"
RUN dotnet build "Aeros.Services.Kubernetes.csproj" -c $publishingProfile -o /app
FROM build AS publish
RUN dotnet publish "Aeros.Services.Kubernetes.csproj" -c $publishingProfile -o /app
FROM base AS final
WORKDIR /app
COPY --from=publish /app .
ENTRYPOINT ["dotnet", "Aeros.Services.Kubernetes.dll"]
I haven't touched the yaml file, but if you need that I can provide it as well. Again, all I've done with this is add a few NuGet packages to the project reference. Build in VisualStudio runs fine, but the docker command:
docker build . --build-arg publishingProfile=Release
is failing with the error mentioned above.
Can someone be so kind as to offer some enlightenment? Thanks!
Edit 1:
I am executing this from the project's folder via a PowerShell command line.
visual-studio docker asp.net-core

My docker build is failing due to the following error:
COPY failed: CreateFile ?C:ProgramDataDockertmpdocker-builder117584470Aeros.Services.KubernetesAeros.Services.Kubernetes.csproj: The system cannot find the path specified.
I am fairly new to docker and have went with the basic project template that is set up when you create a Kubernetes container project template, so I'd figure it would work out of the box, but I'm mistaken.
I'm having problems trying to figure out what it's attempting to due in the temp directory structure and the reason it is failing. Can anyone offer some assistance? I've done some searching and others have said the default docker template was incorrect in Visual Studio, but I'm not seeing any of the files being copied over to the temp directory to begin with, so figuring out what is going on is being rather problematic at the time.
Here is the docker file, the only thing I've added is a publishingProfile arg so I can tell it which profile to use in the Build and Publish steps :
ARG publishingProfile
FROM microsoft/dotnet:2.1-aspnetcore-runtime AS base
WORKDIR /app
EXPOSE 80
FROM microsoft/dotnet:2.1-sdk AS build
WORKDIR /src
COPY ["Aeros.Services.Kubernetes/Aeros.Services.Kubernetes.csproj", "Aeros.Services.Kubernetes/"]
RUN dotnet restore "Aeros.Services.Kubernetes/Aeros.Services.Kubernetes.csproj"
COPY . ./
WORKDIR "/src/Aeros.Services.Kubernetes"
RUN dotnet build "Aeros.Services.Kubernetes.csproj" -c $publishingProfile -o /app
FROM build AS publish
RUN dotnet publish "Aeros.Services.Kubernetes.csproj" -c $publishingProfile -o /app
FROM base AS final
WORKDIR /app
COPY --from=publish /app .
ENTRYPOINT ["dotnet", "Aeros.Services.Kubernetes.dll"]
I haven't touched the yaml file, but if you need that I can provide it as well. Again, all I've done with this is add a few NuGet packages to the project reference. Build in VisualStudio runs fine, but the docker command:
docker build . --build-arg publishingProfile=Release
is failing with the error mentioned above.
Can someone be so kind as to offer some enlightenment? Thanks!
Edit 1:
I am executing this from the project's folder via a PowerShell command line.
visual-studio docker asp.net-core

visual-studio docker asp.net-core

edited Mar 21 at 21:59
Nathan Raley
asked Mar 21 at 21:10
Nathan RaleyNathan Raley
185
185
add a comment |
add a comment |
2 Answers
2
active
oldest
votes
Leandro's comments helped come across the solution.
So first a rundown of that COPY command, it takes two parameters, source and destination.
Within the template for the Dockerfile for Visual Studio, it includes the folder location of the .csproj file it is attempting to copy. In my case, the command read as follows:
COPY ["Aeros.Services.Kubernetes/Aeros.Services.Kubernetes.csproj", "Aeros.Services.Kubernetes/"]
So it is looking for my Aeros.Services.Kubernetes.csproj file in the Aeros.Services.Kubernetes project folder and copying it to the Aeros.Services.Kubernetes folder in the src folder of Docker.
The problem with this is that if you use the default setup, your dockerfile is included inside the project folder. If you are executing the docker build from within the project folder, the syntax for the COPY command is actually looking in the wrong file location. For instance, if your project is TestApp.csproj located in the TestApp project folder, and you are executing the Docker build command for the dockerfile within the same folder, the syntax for that COPY command:
COPY ["TestApp/TestApp.csproj", "TestApp/"]
is actually looking for: TestApp/TestApp/TestApp.csproj.
The correct syntax for the COPY command in this situation should be:
COPY ["TestApp.csproj", "TestApp/"]
since you are already within the TestApp project folder.
Another problem with the default template that may trouble some is that it doesn't copy the web files for the project either, so once you get past the COPY and dotnet restore steps, you will fail during the BUILD with a:
CSC : error CS5001: Program does not contain a static 'Main' method
suitable for an entry point
This is resolved by adding:
COPY . ./
following your RUN dotnet restore command to copy your files.
Once these pieces have been addressed in the default template provided, everything should be functioning as expected.
Thanks for the help!
add a comment |
In which line the problem happens? I do not remember if docker build shows it.
Where are you executing this build? The problem is that it is not finding the file you are trying to copy. It should be local to where the command is executed.
I saw now, the problem is on the first COPY.
Yes, the first copy. I was wanting to test the docker build command, so I set up the project and tried running the docker build to see if it would work. Like I said, that was all created via the project template in visual studio, so I'd have thought that much would have worked out of the box.
– Nathan Raley
Mar 21 at 21:52
You asked where I was executing it from, I'm executing it from within the project's folder via a PowerShell command line.
– Nathan Raley
Mar 21 at 21:58
Do you have this file there: src/Aeros.Services.Kubernetes/Aeros.Services.Kubernetes.csproj ?
– Leandro Donizetti Soares
Mar 21 at 22:00
Anyway it is quite weird. I found a similar thread on docker foruns : forums.docker.com/t/…
– Leandro Donizetti Soares
Mar 21 at 22:06
1
I think I figured it out, and it's a bug with the auto generated docker file. Since the docker file is in the same location as the .csproj file, there was no need for the folder declaration preceding the .csproj filename. Once I removed that, that portion succeeded. Then I was hit by the no static main method error, this was due to the other files not being copied prior to the dotnetbuild command. I added an additional COPY . ./ after the dotnet restore and all seems to be working fine.
– Nathan Raley
Mar 22 at 16:24
|
show 4 more comments
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55289304%2fneed-assistance-with-dockerfile-and-kubernetes-for-aspnetcore-service%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
Leandro's comments helped come across the solution.
So first a rundown of that COPY command, it takes two parameters, source and destination.
Within the template for the Dockerfile for Visual Studio, it includes the folder location of the .csproj file it is attempting to copy. In my case, the command read as follows:
COPY ["Aeros.Services.Kubernetes/Aeros.Services.Kubernetes.csproj", "Aeros.Services.Kubernetes/"]
So it is looking for my Aeros.Services.Kubernetes.csproj file in the Aeros.Services.Kubernetes project folder and copying it to the Aeros.Services.Kubernetes folder in the src folder of Docker.
The problem with this is that if you use the default setup, your dockerfile is included inside the project folder. If you are executing the docker build from within the project folder, the syntax for the COPY command is actually looking in the wrong file location. For instance, if your project is TestApp.csproj located in the TestApp project folder, and you are executing the Docker build command for the dockerfile within the same folder, the syntax for that COPY command:
COPY ["TestApp/TestApp.csproj", "TestApp/"]
is actually looking for: TestApp/TestApp/TestApp.csproj.
The correct syntax for the COPY command in this situation should be:
COPY ["TestApp.csproj", "TestApp/"]
since you are already within the TestApp project folder.
Another problem with the default template that may trouble some is that it doesn't copy the web files for the project either, so once you get past the COPY and dotnet restore steps, you will fail during the BUILD with a:
CSC : error CS5001: Program does not contain a static 'Main' method
suitable for an entry point
This is resolved by adding:
COPY . ./
following your RUN dotnet restore command to copy your files.
Once these pieces have been addressed in the default template provided, everything should be functioning as expected.
Thanks for the help!
add a comment |
Leandro's comments helped come across the solution.
So first a rundown of that COPY command, it takes two parameters, source and destination.
Within the template for the Dockerfile for Visual Studio, it includes the folder location of the .csproj file it is attempting to copy. In my case, the command read as follows:
COPY ["Aeros.Services.Kubernetes/Aeros.Services.Kubernetes.csproj", "Aeros.Services.Kubernetes/"]
So it is looking for my Aeros.Services.Kubernetes.csproj file in the Aeros.Services.Kubernetes project folder and copying it to the Aeros.Services.Kubernetes folder in the src folder of Docker.
The problem with this is that if you use the default setup, your dockerfile is included inside the project folder. If you are executing the docker build from within the project folder, the syntax for the COPY command is actually looking in the wrong file location. For instance, if your project is TestApp.csproj located in the TestApp project folder, and you are executing the Docker build command for the dockerfile within the same folder, the syntax for that COPY command:
COPY ["TestApp/TestApp.csproj", "TestApp/"]
is actually looking for: TestApp/TestApp/TestApp.csproj.
The correct syntax for the COPY command in this situation should be:
COPY ["TestApp.csproj", "TestApp/"]
since you are already within the TestApp project folder.
Another problem with the default template that may trouble some is that it doesn't copy the web files for the project either, so once you get past the COPY and dotnet restore steps, you will fail during the BUILD with a:
CSC : error CS5001: Program does not contain a static 'Main' method
suitable for an entry point
This is resolved by adding:
COPY . ./
following your RUN dotnet restore command to copy your files.
Once these pieces have been addressed in the default template provided, everything should be functioning as expected.
Thanks for the help!
add a comment |
Leandro's comments helped come across the solution.
So first a rundown of that COPY command, it takes two parameters, source and destination.
Within the template for the Dockerfile for Visual Studio, it includes the folder location of the .csproj file it is attempting to copy. In my case, the command read as follows:
COPY ["Aeros.Services.Kubernetes/Aeros.Services.Kubernetes.csproj", "Aeros.Services.Kubernetes/"]
So it is looking for my Aeros.Services.Kubernetes.csproj file in the Aeros.Services.Kubernetes project folder and copying it to the Aeros.Services.Kubernetes folder in the src folder of Docker.
The problem with this is that if you use the default setup, your dockerfile is included inside the project folder. If you are executing the docker build from within the project folder, the syntax for the COPY command is actually looking in the wrong file location. For instance, if your project is TestApp.csproj located in the TestApp project folder, and you are executing the Docker build command for the dockerfile within the same folder, the syntax for that COPY command:
COPY ["TestApp/TestApp.csproj", "TestApp/"]
is actually looking for: TestApp/TestApp/TestApp.csproj.
The correct syntax for the COPY command in this situation should be:
COPY ["TestApp.csproj", "TestApp/"]
since you are already within the TestApp project folder.
Another problem with the default template that may trouble some is that it doesn't copy the web files for the project either, so once you get past the COPY and dotnet restore steps, you will fail during the BUILD with a:
CSC : error CS5001: Program does not contain a static 'Main' method
suitable for an entry point
This is resolved by adding:
COPY . ./
following your RUN dotnet restore command to copy your files.
Once these pieces have been addressed in the default template provided, everything should be functioning as expected.
Thanks for the help!
Leandro's comments helped come across the solution.
So first a rundown of that COPY command, it takes two parameters, source and destination.
Within the template for the Dockerfile for Visual Studio, it includes the folder location of the .csproj file it is attempting to copy. In my case, the command read as follows:
COPY ["Aeros.Services.Kubernetes/Aeros.Services.Kubernetes.csproj", "Aeros.Services.Kubernetes/"]
So it is looking for my Aeros.Services.Kubernetes.csproj file in the Aeros.Services.Kubernetes project folder and copying it to the Aeros.Services.Kubernetes folder in the src folder of Docker.
The problem with this is that if you use the default setup, your dockerfile is included inside the project folder. If you are executing the docker build from within the project folder, the syntax for the COPY command is actually looking in the wrong file location. For instance, if your project is TestApp.csproj located in the TestApp project folder, and you are executing the Docker build command for the dockerfile within the same folder, the syntax for that COPY command:
COPY ["TestApp/TestApp.csproj", "TestApp/"]
is actually looking for: TestApp/TestApp/TestApp.csproj.
The correct syntax for the COPY command in this situation should be:
COPY ["TestApp.csproj", "TestApp/"]
since you are already within the TestApp project folder.
Another problem with the default template that may trouble some is that it doesn't copy the web files for the project either, so once you get past the COPY and dotnet restore steps, you will fail during the BUILD with a:
CSC : error CS5001: Program does not contain a static 'Main' method
suitable for an entry point
This is resolved by adding:
COPY . ./
following your RUN dotnet restore command to copy your files.
Once these pieces have been addressed in the default template provided, everything should be functioning as expected.
Thanks for the help!
answered Mar 22 at 16:39
Nathan RaleyNathan Raley
185
185
add a comment |
add a comment |
In which line the problem happens? I do not remember if docker build shows it.
Where are you executing this build? The problem is that it is not finding the file you are trying to copy. It should be local to where the command is executed.
I saw now, the problem is on the first COPY.
Yes, the first copy. I was wanting to test the docker build command, so I set up the project and tried running the docker build to see if it would work. Like I said, that was all created via the project template in visual studio, so I'd have thought that much would have worked out of the box.
– Nathan Raley
Mar 21 at 21:52
You asked where I was executing it from, I'm executing it from within the project's folder via a PowerShell command line.
– Nathan Raley
Mar 21 at 21:58
Do you have this file there: src/Aeros.Services.Kubernetes/Aeros.Services.Kubernetes.csproj ?
– Leandro Donizetti Soares
Mar 21 at 22:00
Anyway it is quite weird. I found a similar thread on docker foruns : forums.docker.com/t/…
– Leandro Donizetti Soares
Mar 21 at 22:06
1
I think I figured it out, and it's a bug with the auto generated docker file. Since the docker file is in the same location as the .csproj file, there was no need for the folder declaration preceding the .csproj filename. Once I removed that, that portion succeeded. Then I was hit by the no static main method error, this was due to the other files not being copied prior to the dotnetbuild command. I added an additional COPY . ./ after the dotnet restore and all seems to be working fine.
– Nathan Raley
Mar 22 at 16:24
|
show 4 more comments
In which line the problem happens? I do not remember if docker build shows it.
Where are you executing this build? The problem is that it is not finding the file you are trying to copy. It should be local to where the command is executed.
I saw now, the problem is on the first COPY.
Yes, the first copy. I was wanting to test the docker build command, so I set up the project and tried running the docker build to see if it would work. Like I said, that was all created via the project template in visual studio, so I'd have thought that much would have worked out of the box.
– Nathan Raley
Mar 21 at 21:52
You asked where I was executing it from, I'm executing it from within the project's folder via a PowerShell command line.
– Nathan Raley
Mar 21 at 21:58
Do you have this file there: src/Aeros.Services.Kubernetes/Aeros.Services.Kubernetes.csproj ?
– Leandro Donizetti Soares
Mar 21 at 22:00
Anyway it is quite weird. I found a similar thread on docker foruns : forums.docker.com/t/…
– Leandro Donizetti Soares
Mar 21 at 22:06
1
I think I figured it out, and it's a bug with the auto generated docker file. Since the docker file is in the same location as the .csproj file, there was no need for the folder declaration preceding the .csproj filename. Once I removed that, that portion succeeded. Then I was hit by the no static main method error, this was due to the other files not being copied prior to the dotnetbuild command. I added an additional COPY . ./ after the dotnet restore and all seems to be working fine.
– Nathan Raley
Mar 22 at 16:24
|
show 4 more comments
In which line the problem happens? I do not remember if docker build shows it.
Where are you executing this build? The problem is that it is not finding the file you are trying to copy. It should be local to where the command is executed.
I saw now, the problem is on the first COPY.
In which line the problem happens? I do not remember if docker build shows it.
Where are you executing this build? The problem is that it is not finding the file you are trying to copy. It should be local to where the command is executed.
I saw now, the problem is on the first COPY.
answered Mar 21 at 21:46
Leandro Donizetti SoaresLeandro Donizetti Soares
20616
20616
Yes, the first copy. I was wanting to test the docker build command, so I set up the project and tried running the docker build to see if it would work. Like I said, that was all created via the project template in visual studio, so I'd have thought that much would have worked out of the box.
– Nathan Raley
Mar 21 at 21:52
You asked where I was executing it from, I'm executing it from within the project's folder via a PowerShell command line.
– Nathan Raley
Mar 21 at 21:58
Do you have this file there: src/Aeros.Services.Kubernetes/Aeros.Services.Kubernetes.csproj ?
– Leandro Donizetti Soares
Mar 21 at 22:00
Anyway it is quite weird. I found a similar thread on docker foruns : forums.docker.com/t/…
– Leandro Donizetti Soares
Mar 21 at 22:06
1
I think I figured it out, and it's a bug with the auto generated docker file. Since the docker file is in the same location as the .csproj file, there was no need for the folder declaration preceding the .csproj filename. Once I removed that, that portion succeeded. Then I was hit by the no static main method error, this was due to the other files not being copied prior to the dotnetbuild command. I added an additional COPY . ./ after the dotnet restore and all seems to be working fine.
– Nathan Raley
Mar 22 at 16:24
|
show 4 more comments
Yes, the first copy. I was wanting to test the docker build command, so I set up the project and tried running the docker build to see if it would work. Like I said, that was all created via the project template in visual studio, so I'd have thought that much would have worked out of the box.
– Nathan Raley
Mar 21 at 21:52
You asked where I was executing it from, I'm executing it from within the project's folder via a PowerShell command line.
– Nathan Raley
Mar 21 at 21:58
Do you have this file there: src/Aeros.Services.Kubernetes/Aeros.Services.Kubernetes.csproj ?
– Leandro Donizetti Soares
Mar 21 at 22:00
Anyway it is quite weird. I found a similar thread on docker foruns : forums.docker.com/t/…
– Leandro Donizetti Soares
Mar 21 at 22:06
1
I think I figured it out, and it's a bug with the auto generated docker file. Since the docker file is in the same location as the .csproj file, there was no need for the folder declaration preceding the .csproj filename. Once I removed that, that portion succeeded. Then I was hit by the no static main method error, this was due to the other files not being copied prior to the dotnetbuild command. I added an additional COPY . ./ after the dotnet restore and all seems to be working fine.
– Nathan Raley
Mar 22 at 16:24
Yes, the first copy. I was wanting to test the docker build command, so I set up the project and tried running the docker build to see if it would work. Like I said, that was all created via the project template in visual studio, so I'd have thought that much would have worked out of the box.
– Nathan Raley
Mar 21 at 21:52
Yes, the first copy. I was wanting to test the docker build command, so I set up the project and tried running the docker build to see if it would work. Like I said, that was all created via the project template in visual studio, so I'd have thought that much would have worked out of the box.
– Nathan Raley
Mar 21 at 21:52
You asked where I was executing it from, I'm executing it from within the project's folder via a PowerShell command line.
– Nathan Raley
Mar 21 at 21:58
You asked where I was executing it from, I'm executing it from within the project's folder via a PowerShell command line.
– Nathan Raley
Mar 21 at 21:58
Do you have this file there: src/Aeros.Services.Kubernetes/Aeros.Services.Kubernetes.csproj ?
– Leandro Donizetti Soares
Mar 21 at 22:00
Do you have this file there: src/Aeros.Services.Kubernetes/Aeros.Services.Kubernetes.csproj ?
– Leandro Donizetti Soares
Mar 21 at 22:00
Anyway it is quite weird. I found a similar thread on docker foruns : forums.docker.com/t/…
– Leandro Donizetti Soares
Mar 21 at 22:06
Anyway it is quite weird. I found a similar thread on docker foruns : forums.docker.com/t/…
– Leandro Donizetti Soares
Mar 21 at 22:06
1
1
I think I figured it out, and it's a bug with the auto generated docker file. Since the docker file is in the same location as the .csproj file, there was no need for the folder declaration preceding the .csproj filename. Once I removed that, that portion succeeded. Then I was hit by the no static main method error, this was due to the other files not being copied prior to the dotnetbuild command. I added an additional COPY . ./ after the dotnet restore and all seems to be working fine.
– Nathan Raley
Mar 22 at 16:24
I think I figured it out, and it's a bug with the auto generated docker file. Since the docker file is in the same location as the .csproj file, there was no need for the folder declaration preceding the .csproj filename. Once I removed that, that portion succeeded. Then I was hit by the no static main method error, this was due to the other files not being copied prior to the dotnetbuild command. I added an additional COPY . ./ after the dotnet restore and all seems to be working fine.
– Nathan Raley
Mar 22 at 16:24
|
show 4 more comments
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55289304%2fneed-assistance-with-dockerfile-and-kubernetes-for-aspnetcore-service%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown