Trying to run a dotnet core 2.0 app within a docker container fails with the error
Did you mean to run dotnet SDK commands? Please install dotnet SDK from:
http://go.microsoft.com/fwlink/?LinkID=798306&clcid=0x409
as if there is no dotnet actually installed in the runtime image.
FROM microsoft/dotnet:2.0-runtime
or
FROM microsoft/dotnet:2.0.5-runtime
docker build .
docker run -it <image hash>
dotnet --versionFirst of all, I would expect an output of version at least and then any dotnet apps to work
Did you mean to run dotnet SDK commands? Please install dotnet SDK from:
http://go.microsoft.com/fwlink/?LinkID=798306&clcid=0x409
The full application I had when noticing this issue was a dotnet api and I built it with the dockerfile
FROM microsoft/dotnet:2.0-sdk AS build-env
WORKDIR /app
# copy csproj and restore as distinct layers
COPY *.csproj ./
RUN dotnet restore
# copy everything else and build
COPY . ./
RUN dotnet publish -c Release -o out
# build runtime image
FROM microsoft/dotnet:2.0-runtime
WORKDIR /app
COPY --from=build-env /app/out ./
ENTRYPOINT ["dotnet", "dotnetapp.dll"]
This is the same as the one within the dotnet-docker-samples repository and I have used it before without issues.
docker versionDocker version 17.12.0-ce, build c97c6d6
docker info
Containers: 7
Running: 0
Paused: 0
Stopped: 7
Images: 22
Server Version: 17.12.0-ce
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 macvlan null overlay
Log: awslogs fluentd gcplogs gelf journald json-file logentries splunk syslog
Swarm: inactive
Runtimes: runc
Default Runtime: runc
Init Binary: docker-init
containerd version: 89623f28b87a6004d4b785663257362d1658a729
runc version: b2567b37d7b75eb4cf325b77297b140ea686ce8f
init version: 949e6fa
Security Options:
seccomp
Profile: default
Kernel Version: 4.9.60-linuxkit-aufs
Operating System: Docker for Mac
OSType: linux
Architecture: x86_64
CPUs: 2
Total Memory: 1.952GiB
Name: linuxkit-025000000001
ID: AJKD:DU27:AT27:4TAR:CCAS:R2AF:UAX5:ZCLI:C5RG:PTB3:3QSU:P27M
Docker Root Dir: /var/lib/docker
Debug Mode (client): false
Debug Mode (server): false
HTTP Proxy: docker.for.mac.http.internal:3128
HTTPS Proxy: docker.for.mac.http.internal:3129
Registry: https://index.docker.io/v1/
Labels:
Experimental: false
Insecure Registries:
127.0.0.0/8
Live Restore Enabled: false
@TheYorkshireDev, The specific issue you mention in the repo steps is not a Docker issue rather it is a bad dotnet cli/host user experience. dotnet --info is more than likely what you want. This issue covered by https://github.com/dotnet/core-setup/issues/3332.
You mentioned having issues with running an application as well. Can you give the specific steps to reproduce?
@MichaelSimons My issue was related to the .dll having a typo from my Dockerfile so I am going to close.
I'm having the same issue. What do you mean when you say the .dll has a type from your Dockerfile?
@fattredd My comment above had a typo, type was supposed to be _typo_ :)
Check that dotnetapp.dll from the entrypoint line in the dockerfile
...
COPY --from=build-env /app/out ./
ENTRYPOINT ["dotnet", "dotnetapp.dll"]
is actually the name of your <app>.dll
Cheers. I feel dumb now
Most helpful comment
Cheers. I feel dumb now