gurkanindibay
gurkanindibay

Reputation: 101

Invalid Argument error from nexus when building asp.net core docker image in the dotnet restore phase

I'm developing an ASP.NET Core 2.2 Web Api application. This application has one library dependency which is hosted in our Nexus OSS Nuget Hosted Repository.My development machine is Windows 10.I am using docker for desktop as the local container manager and local kubernetes instance. The version of the Nexus OSS is 3.18.1-01. I added the Nexus repo address to my Nuget.config , tried it locally and I haven't experienced a problem. However when I try to dockerize it, package that I hosted in the Nexus repository could not be downloaded in the dotnet restore phase and following error was thrown

Retrying 'FindPackagesByIdAsyncCore' for source 'http://int-nexus:8081/repository/nuget-hosted/FindPackagesById()?id='Project.Common'&semVerLevel=2.0.0'. Invalid Argument

Project.Common is the package name of the library that I hosted on Nexus. I could not find any solutions neither on internet nor on Nexus known issues site. Could you help me to solve the problem

Nuget config file

<?xml version="1.0" encoding="utf-8"?>
<configuration>
    <packageSources>
        <add key="internal-repo" value="http://int-nexus:8081/repository/nuget-hosted/"  />
    </packageSources>
    <activePackageSource>
        <add key="All" value="(Aggregate source)" />
    </activePackageSource>
</configuration>

Docker file

FROM mcr.microsoft.com/dotnet/core/sdk:2.2 AS build
WORKDIR /app

# copy csproj and restore as distinct layers
COPY *.csproj Nuget.Config ./
RUN dotnet restore --configfile=Nuget.Config --no-cache --force

Upvotes: 0

Views: 776

Answers (1)

gurkanindibay
gurkanindibay

Reputation: 101

The nexus machine had been installed on Windows machine.I installed another nexus instance on another linux machine in the same network and changed repo address into the new nexus machine I installed. The error message changed and appeared as below

Retrying 'FindPackagesByIdAsyncCore' for source 'http://int-nexus:8081/repository/nuget-hosted/FindPackagesById()?id='Project.Common'&semVerLevel=2.0.0'. No Route to host

After that clear error message, I understood that the build process in the docker instance could not access nexus machine. And checked my docker for desktop and found out that my kubernetes instance is enabled and because of the issue below, instances in my docker container could not access any address in my local network. By the way the ip range in my local network is 10.1.7.x https://github.com/docker/for-win/issues/1667

Upvotes: 0

Related Questions