-
Notifications
You must be signed in to change notification settings - Fork 1.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[mcr.microsoft.com/dotnet/sdk:5.0] "dotnet watch run" doesn't reload the project when files are changed #2396
Comments
dotnet watch run doesn't work on mcr.microsoft.com/dotnet/sdk:5.0 |
@elafarge, thanks for logging this issue. It looks like this is caused by Breaking Change: Removal of buildpack-deps in 5.0 SDK Docker images. Specifically in my quick test, it seems like this scenario has a dependency on the I was able to get FROM mcr.microsoft.com/dotnet/sdk:5.0
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
procps \
&& rm -rf /var/lib/apt/lists/* |
|
@MichaelSimons thanks a lot for the quick troubleshooting :) I had the feeling it was due to a missing package but I didn't run the investigation far enough to figure out which one. Would you like me to contribute a patch to the https://github.com/dotnet/dotnet-docker/tree/master/eng/dockerfile-templates/runtime-deps/3.1 image ? I've had to get familiar to understand how the sdk images are built, it should be within my reach now :) |
|
@elafarge, Yes we would appreciate your help with fixing this. Before we begin with a fix, we want to ensure that we have the correct set of native dependencies identified. Are there additional dependencies that are missing? @mthalman is going to follow up with the SDK folks on this and will respond here with his findings. In addition to the code fix, there are a two other follow-ups @mthalman will investigate:
Regarding the code changes, we do not want to add this native dependency to the To answer your testing question, yes I think it would be ideal if we had a utest in place. The question is whether we want to validate the dependencies are present or do a scenario test to ensure dotnet watch works. The scenario test will get complicated quickly I'm afraid and be slow. Thanks for your help here. |
|
I've confirmed that it is possible to repro this with a console app project. You just need to have a console app that runs long enough to have time to modify and save a file. Here's my repro:
Expected: Polling file watcher should output that it detected a change. So there's nothing specific about ASP.NET here that causes this behavior. |
|
Would it be possible to include Im guessing almost everyone want to have watch running when developing. And people who are new to Docker+dotnet will probably start out with the mcr.microsoft.com/dotnet/sdk:5.0 image for developing. |
Yes, that is the plan. |
This package is now required for "dotnet watch" to actually watch for file changes on Debian based images. NOTE: with this patch we're installing the package on Ubuntu based-distributions as well, as a (undesired?) side-effect. The alternative would be to use Cottle templating language to only add this patch for debian-based images. The problem is their name varies accross versions (buster, bullseye...) this would have made this bugfix less change-resistant. Caused by: dotnet#2376 Github issue: dotnet#2396
This package is now required for "dotnet watch" to actually watch for file changes on Debian based images. NOTE: with this patch we're installing the package on Ubuntu based-distributions as well, as a (undesired?) side-effect. The alternative would be to use Cottle templating language to only add this patch for debian-based images. The problem is their name varies accross versions (buster, bullseye...) this would have made this bugfix less change-resistant. Caused by: dotnet#2376 Github issue: dotnet#2396
|
Here's a bugfix proposal for this issue @MichaelSimons @mthalman : #2402 . I'll open a separate PR for the new test scenario in the coming days. |
|
@elafarge, FYI, we are still investigating this to ensure that the correct set of native dependencies have been identified. |
On Debian-based distributions, the procps package is required for the "dotnet watch" command to work accordingly. This has introduced a regression in the official sdk:5.0 image recently. This commit adds a test that ensures this package is present on Debian-based distribution (we're assuming an image is Debian based if the "dpkg" command is present). Issue: dotnet#2396
|
And here's a proposal for a test checking that the @MichaelSimons No problem. I'll be happy to update the PR(s) if dependencies need to be updated. |
@MichaelSimons @elafarge in what way does |
|
Ah, I missed the comment that says you are still checking the correct native dependencies. afaik |
This is what I found with a quick investigation. https://github.com/dotnet/aspnetcore/blob/master/src/Shared/Process/ProcessExtensions.cs#L20 @pranavkm can hopefully talk about this and why System.Diagnostics.Process.Kill isn't used here. |
Ah, |
Since .NET 3.1, |
|
This implementation sends the |
|
Yes, this would eliminate the |
|
FYI, in discussing this with @pranavkm, the current plan is to fix this in |
|
Because the |
|
That would sound like a much more appropriate and robust fix indeed :) |
|
@elafarge, kudos for opening this issue, providing the workaround of using the alpine and focal images, as well as your willingness to contribute the fix! |
|
The fix for dotnet/aspnetcore#27950 was pushed to 6.0. As a result, we will need to add the |
|
Fixed as part of #2496 |
|
@mthalman Does this mean procps is added to 5.0 SDK too? mcr.microsoft.com/dotnet/sdk:5.0 for example. im confused :) Thanks! |
|
@tobbbe -
For 6.0, the intention is to not require the |
|
okey I see! thank you for the explanation |
|
Thanks a lot for thi fix @mthalman |
Describe the Bug
Our local
docker-composedevelopment stack consists in a set of containers running our ASP.NET Core APIs where we mount our code and run it withdotnet watch run.We upgraded our services to .NET 5 yesterday, and therefore, our base images to
mcr.microsoft.com/dotnet/sdk:5.0and noticed a bug: files aren't reloaded when changed on the host.A similar issue seems to have been reported here around a month ago.
Steps to Reproduce
Environment:
I'm running Docker on a Linux host but colleagues had the same issue on OSX. I have no information about docker on Windows or in the WSL (but I suspect it impacts at least docker running in the WSL).
Requirements:
dotnet watch runand the code mounted in a containerYou'll notice that when opening, altering and saving the
./Startup.csfile, the service isn't reloaded.Other Information
The issue doesn't occur on the Ubuntu Focal image (
5.0-focal). Neither does it on thealpine-based image but for some unknown reason, (re)build times are significantly slower on Alpine 🤔 .If that can help, I had the same issue when building a custom .NET Core SDK image with the
./dotnet-install.shscripts ondebian:buster-slim,debian:slimanddebian:bullseye, but not when basing the same custom image offubuntu:focal. Oh and one last thing, it used to work well with the3.1image. Maybe a missing dependency in the basedebianimages ?We just switched our local development environment to the official focal image, which completely solved our issue (so we basically don't care if and when this issue gets fixed 👼 ).
Since the
5.0(the "main" image tag line) image is impacted, I thought this bug was worth reporting though.Output of
docker versionOutput of
docker infoThe text was updated successfully, but these errors were encountered: