Create image with TFS - error restoring nugets


I have a project in TFS, I’m using VS 2017 I could create an image in my local machine, my project have a docker file and a docker compose, now I need to deploy the project in a server, which is the firts step I have to do?, I tried to publish the app but I have an error:

Error Building webapplication4
Service ‘webapplication4’ failed to build:
The command ‘powershell -Command $ErrorActionPreference = ‘Stop’; $ProgressPreference = ‘SilentlyContinue’; dotnet restore’ returned a non-zero code: 1.

I think I need to do this:

  1. Publish the porject
  2. copy files to the server
  3. Create the image in the server

but I’m not sure about this, so i would like to ask if there is a manual I can follow, thanks, I hope you can help me.

I tried to run this command

docker-compose -f docker-compose.yml up -d

But in step 8 (restoring nugets) error:

Creating network "src_default" with the default driver
Building myapi
Step 1/17 : FROM microsoft/aspnetcore:2.0-nanoserver-sac2016 AS base
 ---> 920e71ab2ffe
Step 2/17 : WORKDIR /app
 ---> Using cache
 ---> 9c96a540a58c
Step 3/17 : EXPOSE 80
 ---> Using cache
 ---> ca9f9612884d
Step 4/17 : FROM microsoft/aspnetcore-build:2.0-nanoserver-sac2016 AS build
 ---> 30396e7b92d4
Step 5/17 : WORKDIR /src
 ---> Using cache
 ---> 2c37b8d9752a
Step 6/17 : COPY *.sln ./
 ---> Using cache
 ---> 7f3c5105067b
Step 7/17 : COPY MyAPI/MyAPI.csproj MyAPI/
 ---> Using cache
 ---> 0d2def19d7e1
Step 8/17 : RUN dotnet restore
 ---> Running in f71bd4ee4cc7
C:\Program Files\dotnet\sdk\2.1.101\NuGet.targets(242,5): warning MSB3202: The project file "C:\src\docker-compose.dcpro
j" was not found. [C:\src\MyAPI.sln]
C:\src\docker-compose.dcproj : warning NU1503: Skipping restore for project 'C:\src\docker-compose.dcproj'. The project
file may be invalid or missing targets required for restore. [C:\src\MyAPI.sln]
  Restoring packages for C:\src\MyAPI\MyAPI.csproj...
  Restoring packages for C:\src\MyAPI\MyAPI.csproj...
C:\Program Files\dotnet\sdk\2.1.101\NuGet.targets(104,5): error : Unable to load the service index for source https://ap [C:\src\MyAPI.sln]
C:\Program Files\dotnet\sdk\2.1.101\NuGet.targets(104,5): error :   An error occurred while sending the request. [C:\src
C:\Program Files\dotnet\sdk\2.1.101\NuGet.targets(104,5): error :   The operation timed out [C:\src\MyAPI.sln]
ERROR: Service 'myapi' failed to build: The command 'powershell -Command $ErrorActionPreference = 'Stop'; $ProgressPrefe
rence = 'SilentlyContinue'; dotnet restore' returned a non-zero code: 1
1 Like

Same problem here. Please let us know how you get around this.