Docker issues the warning message of "Image may have poor performance, or fail, if run via emulation" on docker when running on Apple M1 machine
- Dominant language
- PowerShell
- Stars
- 1.1k
- Forks
- 215
- Avg merge
- 4h 2m
- Merged PRs (30d)
- 1
Description
I have the following docker file to build an azure function app. This docker file works like a charm when running on an Intel Windows 11 machine, or Intel MacBook Pro.
```docker
FROM mcr.microsoft.com/azure-functions/dotnet-isolated:4-dotnet-isolated6.0 AS base2
WORKDIR /home/site/wwwroot
EXPOSE 80
FROM mcr.microsoft.com/dotnet/runtime:6.0 as runtime6_0
FROM mcr.microsoft.com/dotnet/sdk:6.0 AS build
COPY --from=runtime6_0 /usr/share/dotnet/host /usr/share/dotnet/host
COPY --from=runtime6_0 /usr/share/dotnet/shared /usr/share/dotnet/shared
WORKDIR /src
COPY ["src/MyFunctionApp/.", "MyFunctionApp/"]
RUN dotnet restore "MyFunctionApp/MyFunctionApp.csproj"
COPY . .
WORKDIR "/src/MyFunctionApp"
RUN dotnet build "MyFunctionApp.csproj" -c Release -o /app/build
FROM build AS publish
RUN dotnet publish "MyFunctionApp.csproj" -c Release -o /app/publish
FROM base2 AS final
WORKDIR /home/site/wwwroot
COPY --from=publish /app/publish .
ENV AzureWebJobsScriptRoot=/home/site/wwwroot \
AzureFunctionsJobHost__Logging__Console__IsEnabled=true
```
This docker file fails to work on Apple M1 architecture and produces the warning message mentioned in the title of this post on Docker's UI. I also keep getting the following error message on Apple M1:
> fail: Host.Startup[515] 2023-01-21 11:15:00 A host error has occurred during startup operation '25c137fd-424d-424d-8f4c-18b26fb3960a'. 2023-01-21 11:15:00 System.IO.IOException: Function not implemented 2023-01-21 11:15:00 at System.IO.FileSystemWatcher.StartRaisingEvents() 2023-01-21 11:15:00 at System.IO.FileSystemWatcher.StartRaisingEventsIfNotDisposed() 2023-01-21 11:15:00 at System.IO.FileSystemWatcher.set_EnableRaisingEvents(Boolean value) 2023-01-21 11:15:00 at Microsoft.Azure.WebJobs.Script.IO.AutoRecoveringFileSystemWatcher.InitializeWatcher() in /src/azure-functions-host/src/WebJobs.Script/IO/AutoRecoveringFileSystemWatcher.cs:line 64 2023-01-21 11:15:00 at Microsoft.Azure.WebJobs.Script.IO.AutoRecoveringFileSystemWatcher..ctor(String path, String filter, Boolean includeSubdirectories, WatcherChangeTypes changeTypes, ILoggerFactory loggerFactory) in /src/azure-functions-host/src/WebJobs.Script/IO/AutoRecoveringFileSystemWatcher.cs:line 43 2023-01-21 11:15:00 at Microsoft.Azure.WebJobs.Script.Eventing.File.FileWatcherEventSource..ctor(IScriptEventManager eventManager, String source, String path, String filter, Boolean includeSubdirectories, WatcherChangeTypes changeTypes, ILoggerFactory loggerFactory) in /src/azure-functions-host/src/WebJobs.Script/Eventing/File/FileWatcherEventSource.cs:line 28 2023-01-21 11:15:00 at Microsoft.Azure.WebJobs.Script.WebHost.FileMonitoringService.InitializeFileWatchers() in /src/azure-functions-host/src/WebJobs.Script.WebHost/FileMonitoringService.cs:line 157 2023-01-21 11:15:00 at Microsoft.Azure.WebJobs.Script.WebHost.FileMonitoringService.StartAsync(CancellationToken cancellationToken) in /src/azure-functions-host/src/WebJobs.Script.WebHost/FileMonitoringService.cs:line 93 2023-01-21 11:15:00 at Microsoft.Extensions.Hosting.Internal.Host.StartAsync(CancellationToken cancellationToken) 2023-01-21 11:15:00 at Microsoft.Azure.WebJobs.Script.WebHost.WebJobsScriptHostService.UnsynchronizedStartHostAsync(ScriptHostStartupOperation activeOperation, Int32 attemptCount, JobHostStartupMode startupMode) in /src/azure-functions-host/src/WebJobs.Script.WebHost/WebJobsScriptHostService.cs:line 311 2023-01-21 11:15:00 info: Microsoft.Azure.WebJobs.Hosting.JobHostService[0]
What is the solution to this roadblock/problem? I expect this docker file to work correctly on M1 architecture as it does on Windows 11 docker.
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.