1
votes

I'm using Ubuntu 16.04 LTS,


Docker-compose v 1.18.0-rc2, build 189468b
Docker version 17.12.0-ce-rc1, build ee2f943

Running this command: dotnet publish -o /output with docker results in this error:


ERROR: Service 'generator' failed to build: The command '/bin/sh -c 
dotnet publish -c Release -o out' returned a non-zero code: 145

enter image description here

I've installed the .NET SDK for Ubuntu and not sure how to resolve this error; it just won't create that publish folder; here's dotnet --info

joel@worker-2:~/workspace/asp (copy)/api$ dotnet --info .NET Command Line Tools (2.0.2)

Product Information: Version: 2.0.2 Commit SHA-1 hash: a04b4bf512

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.2/

Microsoft .NET Core Shared Framework Host

Version : 2.0.0 Build : e8b8861ac7faf042c87a5c2f9f2d04c98b69f28d

Link to the same question worded differently with more error logs

2

2 Answers

2
votes

The error you are seeing is because your project contains a global.json file that pins the required SDK version to 2.0.2. However, the docker images contain newer SDK versions (current one is 2.1.3) which. Because no 2.0.2 SDK is present in the docker image you use to build, it just errors out.

1
votes

First, if you are using Ubuntu, docker for Windows is not relevant.

I see dotnet publish -c Release -o out used in "Dockerize a .NET Core application" (and the repo dotnet/dotnet-docker-samples) with images starting with

FROM microsoft/aspnetcore-build:2.0 AS build-env

It is a tag which is multi-arch, meaning it will pull either Windows or Linux containers depending on the host (here Ubuntu)
But you mention in your previous question following the pluralsight.com course docker-images-containers-aspdotnet-core, and that one might only work when done on Windows (meaning Windows server 2016/2017, able to execute Windows images)