Reputation: 515
I just got a MacBook Pro and am trying to run a dotnet core web api project I created on my Windows PC. I also am learning how to use Docker and am trying to integrate it into my project.
When I right click on my API project and hit Add > Docker Support, a docker-compose project and corresponding .yml file are generated and a Dockerfile is added to my Api project.
This is what the .yml file looks like:
version: '3.4'
services:
api:
image: api
build:
context: .
dockerfile: Api/Dockerfile
And here is the Dockerfile that is generated:
FROM microsoft/aspnetcore:2.0 AS base
WORKDIR /app
EXPOSE 80
FROM microsoft/aspnetcore-build:2.0 AS build
WORKDIR /src
COPY AdamWebsiteApi.sln ./
COPY Api/Api.csproj Api/
RUN dotnet restore -nowarn:msb3202,nu1503
COPY . .
WORKDIR /src/Api
RUN dotnet build -c Release -o /app
FROM build AS publish
RUN dotnet publish -c Release -o /app
FROM base AS final
WORKDIR /app
COPY --from=publish /app .
ENTRYPOINT ["dotnet", "Api.dll"]
When I run the solution, using the docker-compose project as the startup, I get the following error:
Cannot start service api: Mounts denied:
The path /usr/local/share/dotnet/sdk/NuGetFallbackFolder
is not shared from OS X and is not known to Docker.
You can configure shared paths from Docker -> Preferences... -> File Sharing.
See https://docs.docker.com/docker-for-mac/osxfs/#namespaces for more info.
Any idea what I need to do to get this working? It might be really simple and obvious but I am very new to Docker and Macs so I'm not sure what I'm doing.
Upvotes: 0
Views: 1187
Reputation: 46
Add the folder /usr/local/share/dotnet/sdk/NuGetFallbackFolder to the File Sharing list in Docker Preferences. It will work.
Upvotes: 1