aspnet / aspnet-docker

[Archived] ASP.NET Core Docker images for 1.x. Go to https://github.com/dotnet/dotnet-docker for 2.1 and up.
https://asp.net
719 stars 171 forks source link

Assemblies not found when running application using microsoft/aspnetcore image #327

Closed phil-harmoniq closed 6 years ago

phil-harmoniq commented 6 years ago

If you are having an issue with microsoft/aspnet, please open an issue on https://github.com/Microsoft/aspnet-docker. This repository is for microsoft/aspnetcore and microsoft/aspnetcore-build.

Steps to reproduce the issue

(e.g. copy your Dockerfile or docker-compose.yml file here)

FROM microsoft/aspnetcore-build:2.0.0 AS builder

WORKDIR /SawneeMed.API.Web
COPY SawneeMed.API.Web/SawneeMed.API.Web.csproj .
RUN dotnet restore
COPY SawneeMed.API.Web/ .
RUN dotnet build -c Release -o out

FROM microsoft/aspnetcore:2.0.0

WORKDIR /SawneeMed.API.Web
COPY --from=builder /SawneeMed.API.Web/out/ .
ENTRYPOINT ["dotnet", "/SawneeMed.API.Web/SawneeMed.API.Web.dll"]

Expected behavior

A running webapi container

Actual behavior

Build process completes, this error happens when trying to run my web app:

Error:
  An assembly specified in the application dependencies manifest (SawneeMed.API.Web.deps.json) was not found:
    package: 'Swashbuckle.AspNetCore.Swagger', version: '1.0.0'
    path: 'lib/netstandard1.6/Swashbuckle.AspNetCore.Swagger.dll'

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

I found this issue that seems similar, but the given advice was to use the microsoft/aspnetcore image to run the application. As you can see, I am using that image. I've also tried building application using the 'linux-x64' runtime identifier, but then I'm hitting this other issue which they claim to have been fixed months ago.

Output of dotnet --info

.NET Command Line Tools (2.0.0)

Product Information:
 Version:            2.0.0
 Commit SHA-1 hash:  cdcd1928c9

Runtime Environment:
 OS Name:     ubuntu
 OS Version:  16.04
 OS Platform: Linux
 RID:         ubuntu.16.04-x64
 Base Path:   /usr/share/dotnet/sdk/2.0.0/

Microsoft .NET Core Shared Framework Host

  Version  : 2.0.0
  Build    : e8b8861ac7faf042c87a5c2f9f2d04c98b69f28d

Output of docker info

Containers: 11
 Running: 0
 Paused: 0
 Stopped: 11
Images: 149
Server Version: 17.09.0-ce
Storage Driver: aufs
 Root Dir: /var/lib/docker/aufs
 Backing Filesystem: extfs
 Dirs: 175
 Dirperm1 Supported: 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: 06b9cb35161009dcb7123345749fef02f7cea8e0
runc version: 3f2f8b84a77f73d38244dd690525642a72156c64
init version: 949e6fa
Security Options:
 apparmor
 seccomp
  Profile: default
Kernel Version: 4.4.0-98-generic
Operating System: Ubuntu 16.04.3 LTS
OSType: linux
Architecture: x86_64
CPUs: 8
Total Memory: 8.771GiB
Name: CENTRAL
ID: WMYL:OAG5:2DAI:Z4Q5:6JRM:EVMQ:HQ43:X2OW:F4W7:WRDN:53MH:3LSI
Docker Root Dir: /var/lib/docker
Debug Mode (client): false
Debug Mode (server): false
Username: philharmoniq
Registry: https://index.docker.io/v1/
Experimental: false
Insecure Registries:
 127.0.0.0/8
Live Restore Enabled: false

WARNING: No swap limit support
phil-harmoniq commented 6 years ago

Well this is embarrassing... I was mistakenly using the dotnet build command instead of dotnet publish. :sweat_smile: