Dotnet-docker: dotnet core 2.0 runtime image doesn't work

Created on 28 Jan 2018  路  5Comments  路  Source: dotnet/dotnet-docker

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.

Steps to reproduce the issue

  1. Create a dockerfile using the runtime image such as:
FROM microsoft/dotnet:2.0-runtime 

or

FROM microsoft/dotnet:2.0.5-runtime
  1. Build the dockerfile
docker build .
  1. Run the dockerfile interactively (to show issue)
docker run -it <image hash>
  1. (Within the container) dotnet --version

Expected behavior

First of all, I would expect an output of version at least and then any dotnet apps to work

Actual behavior

Did you mean to run dotnet SDK commands? Please install dotnet SDK from:
  http://go.microsoft.com/fwlink/?LinkID=798306&clcid=0x409

Additional information (e.g. issue happens only occasionally)

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.

Output of docker version

Docker version 17.12.0-ce, build c97c6d6

Output of 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

Most helpful comment

Cheers. I feel dumb now

All 5 comments

@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

Was this page helpful?
0 / 5 - 0 ratings

Related issues

johnomalley picture johnomalley  路  8Comments

natemcmaster picture natemcmaster  路  5Comments

tonysedniov picture tonysedniov  路  6Comments

wu-yafeng picture wu-yafeng  路  6Comments

MichaelSimons picture MichaelSimons  路  7Comments