microsoft / DockerTools

Tools For Docker, including Visual Studio Provisioning and Publishing
Other
175 stars 26 forks source link

Private Nuget Repositories - building Dockerfile in Visual Studio vs cli #325

Closed mahgo closed 2 years ago

mahgo commented 2 years ago

How does Visual Studio build a dockerfile differently compared to docker build in the cli? I'm trying to work out how dotnet restore authenticates with my private Azure Devops Artifacts nuget repository straight out of the box when the dockerfile is build in Visual Studio - whereas building with docker build, it does not. I know Visual Studio itself is authenticated with my nuget repository automatically, but I'm curious how this automatically works in the docker build in Visual Studio.

NCarlsonMSFT commented 2 years ago

For details on how VS is building your container see: https://aka.ms/containerfastmode#debugging

Short version: for VS debugging we build on windows, and volume map the result.

For building in the container, you will need to add a PAT for authenticating. Here is a stack-overflow with some suggestions: https://stackoverflow.com/questions/64839943/cannot-connect-to-azure-nuget-feed-when-creating-a-container

mahgo commented 2 years ago

Thanks, that explains it! I didn't realize that it doesn't use the Dockerfile when in Debug mode