Dotnet-docker: Can't build F# project in alpine based sdk container

Created on 12 Jul 2018  路  1Comment  路  Source: dotnet/dotnet-docker

Steps to reproduce the issue

Dockerfile:

FROM microsoft/dotnet:2.1.302-sdk-alpine3.7 AS build-env
WORKDIR /app

# Copy csproj and restore as distinct layers
COPY *.fsproj ./
RUN dotnet restore

# Copy everything else and build
COPY . ./
RUN dotnet publish -c Release -o out

# Build runtime image
FROM microsoft/dotnet:2.1-runtime-alpine
WORKDIR /app
COPY --from=build-env /app/out .
ENTRYPOINT ["dotnet", "dotnet-canopy.dll"]
  1. dotnet new console -lang f#
  2. add Dockerfile from above
  3. docker build -t app .

Expected behavior

successfully built container

Actual behavior

error message on step with publish:

Step 6/10 : RUN dotnet publish -c Release -o out
 ---> Running in faa4c69a6e07
Microsoft (R) Build Engine version 15.7.179.6572 for .NET Core
Copyright (C) Microsoft Corporation. All rights reserved.

  Restore completed in 35.63 ms for /app/app.fsproj.
/usr/share/dotnet/sdk/2.1.302/FSharp/Microsoft.FSharp.Targets(263,9): error MSB6006: "RunFsc.sh" exited with code 127. [/app/app.fsproj]
The command '/bin/sh -c dotnet publish -c Release -o out' returned a non-zero code: 1

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

It works in the same sdk version without "-alpine"

Output of docker version

Client:
 Version:      18.05.0-ce
 API version:  1.37
 Go version:   go1.9.5
 Git commit:   f150324
 Built:        Wed May  9 22:12:05 2018
 OS/Arch:      darwin/amd64
 Experimental: false
 Orchestrator: swarm

Server:
 Engine:
  Version:      18.05.0-ce
  API version:  1.37 (minimum version 1.12)
  Go version:   go1.10.1
  Git commit:   f150324
  Built:        Wed May  9 22:20:16 2018
  OS/Arch:      linux/amd64
  Experimental: true

Output of docker info

Containers: 28
 Running: 0
 Paused: 0
 Stopped: 28
Images: 62
Server Version: 18.05.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 ipvlan 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: 773c489c9c1b21a6d78b5c538cd395416ec50f88
runc version: 4fc53a81fb7c994640722ac585fa9ca548971871
init version: 949e6fa
Security Options:
 seccomp
  Profile: default
Kernel Version: 4.9.93-linuxkit-aufs
Operating System: Docker for Mac
OSType: linux
Architecture: x86_64
CPUs: 4
Total Memory: 1.952GiB
Name: linuxkit-025000000001
ID: 74LR:7A5H:7SSR:EXG6:YLXH:TJGZ:AB6S:I3VV:FOPX:3YFA:GANK:RXEH
Docker Root Dir: /var/lib/docker
Debug Mode (client): false
Debug Mode (server): true
 File Descriptors: 22
 Goroutines: 41
 System Time: 2018-07-12T20:49:01.1227531Z
 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:
 127.0.0.0/8
Live Restore Enabled: false
area-dockerfiles duplicate

Most helpful comment

This is an issue with the CLI itself - see https://github.com/dotnet/cli/issues/9538. It has a dependency on bash which is not included in the Alpine image out of the box. We do not want to add it to the image as we will be unable to remove it once the underlying product issue is fixed (it would be considered a breaking change). A workaround is for you to add bash within your own layer.

>All comments

This is an issue with the CLI itself - see https://github.com/dotnet/cli/issues/9538. It has a dependency on bash which is not included in the Alpine image out of the box. We do not want to add it to the image as we will be unable to remove it once the underlying product issue is fixed (it would be considered a breaking change). A workaround is for you to add bash within your own layer.

Was this page helpful?
0 / 5 - 0 ratings