Closed jdanton closed 1 week ago
Looks like we've only build the container image for linux/amd64
which is backed up by https://github.com/Azure/data-api-builder/blob/main/.pipelines/build-pipelines.yml#L269-L310
We'll need to add a --platform
flag to the task that generates linux/amd64
and linux/arm64
, although I'm not sure how to do that with https://learn.microsoft.com/en-us/azure/devops/pipelines/tasks/reference/docker-v2?view=azure-pipelines&tabs=yaml
Oh, looks like the task doesn't natively support it, nor has there been much traction to get it supported - https://github.com/microsoft/azure-pipelines-tasks/issues/16491
Might have to fall back to using scripts within the pipeline to call Docker directly.
https://github.com/Azure/data-api-builder/blob/main/Dockerfile
FROM mcr.microsoft.com/dotnet/sdk:6.0 as build
WORKDIR /src
COPY [".", "./"]
RUN dotnet build "./src/Service/Azure.DataApiBuilder.Service.csproj" -c Docker -o /out -r linux-x64
FROM mcr.microsoft.com/dotnet/aspnet:6.0 as runtime
COPY --from=build /out /App
WORKDIR /App
ENV ASPNETCORE_URLS=http://+:5000
ENTRYPOINT ["dotnet", "Azure.DataApiBuilder.Service.dll"]
Needs
RUN dotnet build "./src/Service/Azure.DataApiBuilder.Service.csproj" -c Docker -o /out -r linux-arm64
Otherwise: WARNING: The requested image's platform (linux/amd64) does not match the detected host platform (linux/arm64/v8) and no specific platform was requested 9ca10b1e8ad7c52c34b2db380ce24dacb73cb93518230475aa5a4a1c26ed67ff
Related:
Hi @JerryNixon,
Given the previous updates rolled out to Docker Desktop for macOS, this recommendation I gave you a few months back might not be needed anymore:
Needs:
RUN dotnet build "./src/Service/Azure.DataApiBuilder.Service.csproj" -c Docker -o /out -r linux-arm64
Otherwise:
WARNING: The requested image's platform (linux/amd64) does not match the detected host platform (linux/arm64/v8), and no specific platform was requested 9ca10b1e8ad7c52c34b2db380ce24dacb73cb93518230475aa5a4a1c26ed67ff
The work around is simple, just two steps:
Rosetta for x86/amd64 emulation on Apple Silicon
option in Docker Desktop for macOS (+13.0)--platform linux/amd64
option, as follows:docker run \
--name DAB-Library \
--volume "./DAB-Config:/App/configs" \
--publish 5001:5000 \
--env-file "./DAB-Config/.env" \
--network library-network \
--platform linux/amd64 \
--detach mcr.microsoft.com/azure-databases/data-api-builder:latest \
--ConfigFileName /App/configs/dab-config.json
Let me know if you have any questions.
What happened?
When following this doc:
https://github.com/Azure/data-api-builder/blob/main/docs/running-using-a-container.md
I get the following error:
WARNING: The requested image's platform (linux/amd64) does not match the detected host platform (linux/arm64/v8) and no specific platform was requested docker: Error response from daemon: Ports are not available: exposing port TCP 0.0.0.0:5000 -> 0.0.0.0:0: listen tcp 0.0.0.0:5000: bind: address already in use. ERRO[0130] error waiting for container: context canceled
Version
Microsoft.DataApiBuilder 0.5.34
What database are you using?
PostgreSQL
What hosting model are you using?
Custom Docker host
Which API approach are you accessing DAB through?
REST
Relevant log output
Code of Conduct