Closed chrisbecke closed 5 years ago
To add to this. I am using VS 2019. I have added linux container support to my newly created MVC app. Previously I had both VS 2019 and the preview installed, as well as, SDK's from 2.1
to 3.0-rc1
. I had also used a few nightlies around the time of preview 8. It appears to me that all have been uninstalled and then I reinstalled VS 2019 and dotnet core 3.0.
My dockerfile only differs by project name.
When I try to run my project from docker the error I get is similar except for 3.0.0-preview7.19365.7 at [/usr/share/dotnet/shared/Microsoft.AspNetCore.App]
. I don't know much about the intricacies docker, so I have no (good) guesses as to why a different framework is detected for me. Maybe some load balancing when pulling images from mcr.microsoft.com
, or some sort of image caching on local machine?
Ultimately, I would like my app to run in alpine containers. While trying to modify my docker file to run alpine containers I discovered a work around for the time being.
Instead of using the *buster*
tags, I was able to run my app using the tag: latest
@chrisbecke see above for my work around.
I tried searching to see where things like "buster" etc were documented: I had figured, given the lack of other reports, that this is probably some kind of cdn cache issue and thought to try a different tag. But got distracted by the futile search. I'll give that another go.
Have you made sure to run docker pull
prior to building your Docker image (e.g. docker pull mcr.microsoft.com/dotnet/core/sdk:3.0-buster
). This will ensure you're using the latest version of that tag.
@mthalman Personally, I have only used Visual Studio's docker integration. By this I mean, I have a dockerfile (generated by VS), and click the play button (or press F5). It appears as though a new image is pulled, but I am not sure how I would know for sure.
@cskwrd - You can know for sure by running the docker pull
command. It'll either pull down a new version or no-op if you've got the latest.
There is not a way to do this from VS? Do I (or a dev working on my project) need to just know that this step must be preformed from time to time? Is that part of the normal docker workflow? Is there a change that I can make to my project or dockerfile to disable caching?
@cskwrd - I don't know. This repo is for issues with the .NET Docker images, not the VS tools. I'm just trying to gather information so we can diagnose where the issue is.
Ah okay. I will check tonight and report back. Thanks!
@mthalman I believe my issue is that the image is cached. I added --pull
as an arg to docker build
, and I am able to now run my app in an alpine container.
From a docker(file) point of view, once a new version of dotnet is released I would need to use --pull
to update my local cache of the latest
tag correct?
From a docker(file) point of view, once a new version of dotnet is released I would need to use
--pull
to update my local cache of thelatest
tag correct?
Yes, that's true for any tag.
@chrisbecke - What about you? Have you made sure to pull the latest version of the tag?
@bwateratmsft - Does the VS Docker Tools have any logic to support the automatic pulling of the latest tag when building? What's the story for the tools here?
@mthalman We're adding some in 16.4 for that. More here: https://github.com/microsoft/DockerTools/issues/214
It'll happen on project open, though. Our default will be to pull all .NET Core base images. You can choose none, .NET Core, or all (.NET Core + .NET Framework). We didn't do .NET Framework by default because the images are so huge it makes for a bad UX.
Yep - docker pull got a fresher version of the runtime image :-
$ docker pull mcr.microsoft.com/dotnet/core/aspnet:3.0-buster-slim
3.0-buster-slim: Pulling from dotnet/core/aspnet
b8f262c62ec6: Pull complete
c1bb02c48b82: Pull complete
aac1cb0f3412: Pull complete
9e34bee673bb: Pull complete
e1c733f95268: Pull complete
Digest: sha256:b0fd451ed5dcd9c86a5c5364b478ebfb411beada0740369127fa53bca365650f
Status: Downloaded newer image for mcr.microsoft.com/dotnet/core/aspnet:3.0-buster-slim
I still had to clean the project - which I wasn't expecting - but thereafter it ran.
Steps to reproduce the issue
Expected behavior
The project should build and run successfully using docker-compose.
Actual behavior
The WebAPI fails to start in docker as the selected image does not have a compatible framework.
This error appears in the application output.
Additional information (e.g. issue happens only occasionally)
dotnet --version
run on my PC yields 3.0.100, and running the project without the docker-compose works perfectly. Examining the generated runtimeconfig.json confirms that Visual Studio expects AsoNetCore.App 3.0.0 to be available:and the generated Dockerfile is using the latest image descriptions:
Output of
docker version
Client: Debug Mode: false
Server: Containers: 48 Running: 2 Paused: 0 Stopped: 46 Images: 177 Server Version: 19.03.2 Storage Driver: overlay2 Backing Filesystem: extfs Supports d_type: true Native Overlay Diff: true Logging Driver: json-file Cgroup Driver: cgroupfs Plugins: Volume: local Network: bridge host ipvlan macvlan null overlay Log: awslogs fluentd gcplogs gelf journald json-file local logentries splunk syslog Swarm: inactive Runtimes: runc Default Runtime: runc Init Binary: docker-init containerd version: 894b81a4b802e4eb2a91d1ce216b8817763c29fb runc version: 425e105d5a03fabd737a126ad93d62a9eeede87f init version: fec3683 Security Options: seccomp Profile: default Kernel Version: 4.9.184-linuxkit Operating System: Docker Desktop OSType: linux Architecture: x86_64 CPUs: 2 Total Memory: 1.952GiB Name: docker-desktop ID: AUTG:FMMK:AQ7K:GPPC:PW3D:QDGC:YDYL:LANZ:4H2B:3ANY:KNTS:M35I Docker Root Dir: /var/lib/docker Debug Mode: true File Descriptors: 36 Goroutines: 51 System Time: 2019-10-01T05:41:17.640626941Z EventsListeners: 2 HTTP Proxy: gateway.docker.internal:3128 HTTPS Proxy: gateway.docker.internal:3129 Registry: https://index.docker.io/v1/ Labels: Experimental: true Insecure Registries: der2377:5000 127.0.0.0/8 Live Restore Enabled: false Product License: Community Engine