Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Docker .NET7.0 publish PublishAot fail with no gcc #4289

Closed
Cricle opened this issue Jan 3, 2023 · 1 comment
Closed

Docker .NET7.0 publish PublishAot fail with no gcc #4289

Cricle opened this issue Jan 3, 2023 · 1 comment

Comments

@Cricle
Copy link

Cricle commented Jan 3, 2023

Describe the Bug

Steps to Reproduce

  • Dockerfile here
# https://hub.docker.com/_/microsoft-dotnet
FROM mcr.microsoft.com/dotnet/sdk:7.0-alpine AS build
WORKDIR /source

# copy everything else and build app
COPY . .
RUN dotnet publish -c Release -o /app -r linux-musl-x64 /p:PublishAot=true

# final stage/image
FROM mcr.microsoft.com/dotnet/runtime-deps:7.0.1-alpine3.17-amd64

EXPOSE 80
EXPOSE 443
VOLUME /app/sentences

WORKDIR /app
COPY --from=build /app .
ENTRYPOINT ["./Brief.Api"]

# See: https://github.com/dotnet/announcements/issues/20
# Uncomment to enable globalization APIs (or delete)
# ENV \
#     DOTNET_SYSTEM_GLOBALIZATION_INVARIANT=false \
#     LC_ALL=en_US.UTF-8 \
#     LANG=en_US.UTF-8
# RUN apk add --no-cache \
#     icu-data-full \
#     icu-libs
  • Run command docker build -t xxx . will fail
[+] Building 17.0s (10/12)
 => [internal] load build definition from Dockerfile                                                               0.4s
 => => transferring dockerfile: 783B                                                                               0.0s
 => [internal] load .dockerignore                                                                                  0.5s
 => => transferring context: 35B                                                                                   0.0s
 => [internal] load metadata for mcr.microsoft.com/dotnet/runtime-deps:7.0.1-alpine3.17-amd64                      0.6s
 => [internal] load metadata for mcr.microsoft.com/dotnet/sdk:7.0-alpine                                           0.7s
 => [build 1/4] FROM mcr.microsoft.com/dotnet/sdk:7.0-alpine@sha256:fdd96f40a73a6908c198970ece2faa1da43942e6b48e4  0.0s
 => [stage-1 1/3] FROM mcr.microsoft.com/dotnet/runtime-deps:7.0.1-alpine3.17-amd64@sha256:108d22196c3c248f0cdb8f  0.0s
 => [internal] load build context                                                                                  0.3s
 => => transferring context: 834B                                                                                  0.0s
 => CACHED [build 2/4] WORKDIR /source                                                                             0.0s
 => CACHED [build 3/4] COPY . .                                                                                    0.0s
 => ERROR [build 4/4] RUN dotnet publish -c Release -o /app -r linux-musl-x64 /p:PublishAot=true                  15.3s
------
 > [build 4/4] RUN dotnet publish -c Release -o /app -r linux-musl-x64 /p:PublishAot=true:
#11 1.144 MSBuild version 17.4.0+18d5aef85 for .NET
#11 1.865   Determining projects to restore...
#11 7.067   Restored /source/Brief.Api.csproj (in 4.74 sec).
#11 10.29   Brief.Api -> /source/bin/Release/net7.0/linux-musl-x64/Brief.Api.dll
#11 10.52 /usr/share/dotnet/sdk/7.0.101/Sdks/Microsoft.DotNet.ILCompiler/build/Microsoft.NETCore.Native.Unix.targets(130,5): error : Platform linker ('clang' or 'gcc') not found in PATH. Try installing appropriate package for clang or gcc to resolve the problem. [/source/Brief.Api.csproj]
------
executor failed running [/bin/sh -c dotnet publish -c Release -o /app -r linux-musl-x64 /p:PublishAot=true]: exit code: 1

Other Information

Output of docker version

Client:
 Cloud integration: v1.0.29
 Version:           20.10.17
 API version:       1.41
 Go version:        go1.17.11
 Git commit:        100c701
 Built:             Mon Jun  6 23:09:02 2022
 OS/Arch:           windows/amd64
 Context:           default
 Experimental:      true

Server: Docker Desktop 4.12.0 (85629)
 Engine:
  Version:          20.10.17
  API version:      1.41 (minimum version 1.12)
  Go version:       go1.17.11
  Git commit:       a89b842
  Built:            Mon Jun  6 23:01:23 2022
  OS/Arch:          linux/amd64
  Experimental:     false
 containerd:
  Version:          1.6.8
  GitCommit:        9cd3357b7fd7218e4aec3eae239db1f68a5a6ec6
 runc:
  Version:          1.1.4
  GitCommit:        v1.1.4-0-g5fd4c4d
 docker-init:
  Version:          0.19.0
  GitCommit:        de40ad0

Output of docker info

Client:
 Context:    default
 Debug Mode: false
 Plugins:
  buildx: Docker Buildx (Docker Inc., v0.9.1)
  compose: Docker Compose (Docker Inc., v2.10.2)
  extension: Manages Docker extensions (Docker Inc., v0.2.9)
  sbom: View the packaged-based Software Bill Of Materials (SBOM) for an image (Anchore Inc., 0.6.0)
  scan: Docker Scan (Docker Inc., v0.19.0)

Server:
 Containers: 5
  Running: 1
  Paused: 0
  Stopped: 4
 Images: 27
 Server Version: 20.10.17
 Storage Driver: overlay2
  Backing Filesystem: extfs
  Supports d_type: true
  Native Overlay Diff: true
  userxattr: false
 Logging Driver: json-file
 Cgroup Driver: cgroupfs
 Cgroup Version: 1
 Plugins:
  Volume: local
  Network: bridge host ipvlan macvlan null overlay
  Log: awslogs fluentd gcplogs gelf journald json-file local logentries splunk syslog
 Swarm: inactive
 Runtimes: io.containerd.runc.v2 io.containerd.runtime.v1.linux runc
 Default Runtime: runc
 Init Binary: docker-init
 containerd version: 9cd3357b7fd7218e4aec3eae239db1f68a5a6ec6
 runc version: v1.1.4-0-g5fd4c4d
 init version: de40ad0
 Security Options:
  seccomp
   Profile: default
 Kernel Version: 5.10.102.1-microsoft-standard-WSL2
 Operating System: Docker Desktop
 OSType: linux
 Architecture: x86_64
 CPUs: 6
 Total Memory: 25GiB
 Name: docker-desktop
 ID: BHDN:5VCB:IH7M:KZO2:UR7Z:VEET:NZKQ:UCNH:SFRA:CTE5:DFX2:URWW
 Docker Root Dir: /var/lib/docker
 Debug Mode: false
 HTTP Proxy: http.docker.internal:3128
 HTTPS Proxy: http.docker.internal:3128
 No Proxy: hubproxy.docker.internal,http://f1361db2.m.daocloud.io
 Registry: https://index.docker.io/v1/
 Labels:
 Experimental: false
 Insecure Registries:
  hubproxy.docker.internal:5000
  127.0.0.0/8
 Registry Mirrors:
  https://f9jdxjwm.mirror.aliyuncs.com/
 Live Restore Enabled: false

WARNING: No blkio throttle.read_bps_device support
WARNING: No blkio throttle.write_bps_device support
WARNING: No blkio throttle.read_iops_device support
WARNING: No blkio throttle.write_iops_device support
@mthalman
Copy link
Member

mthalman commented Jan 3, 2023

Native AOT deployment is not currently supported from the SDK container. This is covered by #4129.

@mthalman mthalman closed this as not planned Won't fix, can't repro, duplicate, stale Jan 3, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants