question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Build the docker image failed

See original GitHub issue

I have got this error when I tried to build the image on Windows.

Step 8/14 : RUN dotnet build src/BaGet -c Release -o /app
 ---> Running in 5ba65c918ade
Microsoft (R) Build Engine version 15.9.20+g88f5fadfbe for .NET Core
Copyright (C) Microsoft Corporation. All rights reserved.

  Restore completed in 48.98 ms for /src/src/BaGet.Core/BaGet.Core.csproj.
  Restore completed in 48.98 ms for /src/src/BaGet.Azure/BaGet.Azure.csproj.
  Restore completed in 25.99 ms for /src/src/BaGet/BaGet.csproj.
/root/.nuget/packages/nerdbank.gitversioning/2.2.13/build/Nerdbank.GitVersioning.targets(63,5): error MSB4018: The "Nerdbank.GitVersioning.Tasks.GetBuildVersion" task failed unexpectedly. [/src/src/BaGet.Core/BaGet.Core.csproj]
/root/.nuget/packages/nerdbank.gitversioning/2.2.13/build/Nerdbank.GitVersioning.targets(63,5): error MSB4018: System.TypeInitializationException: The type initializer for 'LibGit2Sharp.Core.NativeMethods' threw an exception. ---> System.DllNotFoundException: Unable to load shared library '/root/.nuget/packages/nerdbank.gitversioning/2.2.13/build/lib/linux/x86_64/libgit2-6311e88.so' or one of its dependencies. In order to help diagnose loading problems, consider setting the LD_DEBUG environment variable: libssl.so.1.0.0: cannot open shared object file: No such file or directory [/src/src/BaGet.Core/BaGet.Core.csproj]
/root/.nuget/packages/nerdbank.gitversioning/2.2.13/build/Nerdbank.GitVersioning.targets(63,5): error MSB4018:    at System.Runtime.Loader.AssemblyLoadContext.InternalLoadUnmanagedDllFromPath(String unmanagedDllPath) [/src/src/BaGet.Core/BaGet.Core.csproj]
/root/.nuget/packages/nerdbank.gitversioning/2.2.13/build/Nerdbank.GitVersioning.targets(63,5): error MSB4018:    at System.Runtime.Loader.AssemblyLoadContext.LoadUnmanagedDllFromPath(String unmanagedDllPath) [/src/src/BaGet.Core/BaGet.Core.csproj]
/root/.nuget/packages/nerdbank.gitversioning/2.2.13/build/Nerdbank.GitVersioning.targets(63,5): error MSB4018:    at MSBuildExtensionTask.ContextAwareTask.CustomAssemblyLoader.LoadUnmanagedDll(String unmanagedDllName) [/src/src/BaGet.Core/BaGet.Core.csproj]
/root/.nuget/packages/nerdbank.gitversioning/2.2.13/build/Nerdbank.GitVersioning.targets(63,5): error MSB4018:    at System.Runtime.Loader.AssemblyLoadContext.ResolveUnmanagedDll(String unmanagedDllName, IntPtr gchManagedAssemblyLoadContext) [/src/src/BaGet.Core/BaGet.Core.csproj]
/root/.nuget/packages/nerdbank.gitversioning/2.2.13/build/Nerdbank.GitVersioning.targets(63,5): error MSB4018:    at LibGit2Sharp.Core.NativeMethods.git_libgit2_init() [/src/src/BaGet.Core/BaGet.Core.csproj]
/root/.nuget/packages/nerdbank.gitversioning/2.2.13/build/Nerdbank.GitVersioning.targets(63,5): error MSB4018:    at LibGit2Sharp.Core.NativeMethods.LoadNativeLibrary() [/src/src/BaGet.Core/BaGet.Core.csproj]
/root/.nuget/packages/nerdbank.gitversioning/2.2.13/build/Nerdbank.GitVersioning.targets(63,5): error MSB4018:    at LibGit2Sharp.Core.NativeMethods..cctor() [/src/src/BaGet.Core/BaGet.Core.csproj]
/root/.nuget/packages/nerdbank.gitversioning/2.2.13/build/Nerdbank.GitVersioning.targets(63,5): error MSB4018:    --- End of inner exception stack trace --- [/src/src/BaGet.Core/BaGet.Core.csproj]
/root/.nuget/packages/nerdbank.gitversioning/2.2.13/build/Nerdbank.GitVersioning.targets(63,5): error MSB4018:    at LibGit2Sharp.Core.NativeMethods.git_libgit2_opts(Int32 option, UInt32 level, String path) [/src/src/BaGet.Core/BaGet.Core.csproj]
/root/.nuget/packages/nerdbank.gitversioning/2.2.13/build/Nerdbank.GitVersioning.targets(63,5): error MSB4018:    at LibGit2Sharp.GlobalSettings.SetConfigSearchPaths(ConfigurationLevel level, String[] paths) [/src/src/BaGet.Core/BaGet.Core.csproj]
/root/.nuget/packages/nerdbank.gitversioning/2.2.13/build/Nerdbank.GitVersioning.targets(63,5): error MSB4018:    at Nerdbank.GitVersioning.GitExtensions.OpenGitRepo(String pathUnderGitRepo) [/src/src/BaGet.Core/BaGet.Core.csproj]
/root/.nuget/packages/nerdbank.gitversioning/2.2.13/build/Nerdbank.GitVersioning.targets(63,5): error MSB4018:    at Nerdbank.GitVersioning.VersionOracle.Create(String projectDirectory, String gitRepoDirectory, ICloudBuild cloudBuild, Nullable`1 overrideBuildNumberOffset, String projectPathRelativeToGitRepoRoot) [/src/src/BaGet.Core/BaGet.Core.csproj]
/root/.nuget/packages/nerdbank.gitversioning/2.2.13/build/Nerdbank.GitVersioning.targets(63,5): error MSB4018:    at Nerdbank.GitVersioning.Tasks.GetBuildVersion.ExecuteInner() [/src/src/BaGet.Core/BaGet.Core.csproj]

Build FAILED.

/root/.nuget/packages/nerdbank.gitversioning/2.2.13/build/Nerdbank.GitVersioning.targets(63,5): error MSB4018: The "Nerdbank.GitVersioning.Tasks.GetBuildVersion" task failed unexpectedly. [/src/src/BaGet.Core/BaGet.Core.csproj]
/root/.nuget/packages/nerdbank.gitversioning/2.2.13/build/Nerdbank.GitVersioning.targets(63,5): error MSB4018: System.TypeInitializationException: The type initializer for 'LibGit2Sharp.Core.NativeMethods' threw an exception. ---> System.DllNotFoundException: Unable to load shared library '/root/.nuget/packages/nerdbank.gitversioning/2.2.13/build/lib/linux/x86_64/libgit2-6311e88.so' or one of its dependencies. In order to help diagnose loading problems, consider setting the LD_DEBUG environment variable: libssl.so.1.0.0: cannot open shared object file: No such file or directory [/src/src/BaGet.Core/BaGet.Core.csproj]
/root/.nuget/packages/nerdbank.gitversioning/2.2.13/build/Nerdbank.GitVersioning.targets(63,5): error MSB4018:    at System.Runtime.Loader.AssemblyLoadContext.InternalLoadUnmanagedDllFromPath(String unmanagedDllPath) [/src/src/BaGet.Core/BaGet.Core.csproj]
/root/.nuget/packages/nerdbank.gitversioning/2.2.13/build/Nerdbank.GitVersioning.targets(63,5): error MSB4018:    at System.Runtime.Loader.AssemblyLoadContext.LoadUnmanagedDllFromPath(String unmanagedDllPath) [/src/src/BaGet.Core/BaGet.Core.csproj]
/root/.nuget/packages/nerdbank.gitversioning/2.2.13/build/Nerdbank.GitVersioning.targets(63,5): error MSB4018:    at MSBuildExtensionTask.ContextAwareTask.CustomAssemblyLoader.LoadUnmanagedDll(String unmanagedDllName) [/src/src/BaGet.Core/BaGet.Core.csproj]
/root/.nuget/packages/nerdbank.gitversioning/2.2.13/build/Nerdbank.GitVersioning.targets(63,5): error MSB4018:    at System.Runtime.Loader.AssemblyLoadContext.ResolveUnmanagedDll(String unmanagedDllName, IntPtr gchManagedAssemblyLoadContext) [/src/src/BaGet.Core/BaGet.Core.csproj]
/root/.nuget/packages/nerdbank.gitversioning/2.2.13/build/Nerdbank.GitVersioning.targets(63,5): error MSB4018:    at LibGit2Sharp.Core.NativeMethods.git_libgit2_init() [/src/src/BaGet.Core/BaGet.Core.csproj]
/root/.nuget/packages/nerdbank.gitversioning/2.2.13/build/Nerdbank.GitVersioning.targets(63,5): error MSB4018:    at LibGit2Sharp.Core.NativeMethods.LoadNativeLibrary() [/src/src/BaGet.Core/BaGet.Core.csproj]
/root/.nuget/packages/nerdbank.gitversioning/2.2.13/build/Nerdbank.GitVersioning.targets(63,5): error MSB4018:    at LibGit2Sharp.Core.NativeMethods..cctor() [/src/src/BaGet.Core/BaGet.Core.csproj]
/root/.nuget/packages/nerdbank.gitversioning/2.2.13/build/Nerdbank.GitVersioning.targets(63,5): error MSB4018:    --- End of inner exception stack trace --- [/src/src/BaGet.Core/BaGet.Core.csproj]
/root/.nuget/packages/nerdbank.gitversioning/2.2.13/build/Nerdbank.GitVersioning.targets(63,5): error MSB4018:    at LibGit2Sharp.Core.NativeMethods.git_libgit2_opts(Int32 option, UInt32 level, String path) [/src/src/BaGet.Core/BaGet.Core.csproj]
/root/.nuget/packages/nerdbank.gitversioning/2.2.13/build/Nerdbank.GitVersioning.targets(63,5): error MSB4018:    at LibGit2Sharp.GlobalSettings.SetConfigSearchPaths(ConfigurationLevel level, String[] paths) [/src/src/BaGet.Core/BaGet.Core.csproj]
/root/.nuget/packages/nerdbank.gitversioning/2.2.13/build/Nerdbank.GitVersioning.targets(63,5): error MSB4018:    at Nerdbank.GitVersioning.GitExtensions.OpenGitRepo(String pathUnderGitRepo) [/src/src/BaGet.Core/BaGet.Core.csproj]
/root/.nuget/packages/nerdbank.gitversioning/2.2.13/build/Nerdbank.GitVersioning.targets(63,5): error MSB4018:    at Nerdbank.GitVersioning.VersionOracle.Create(String projectDirectory, String gitRepoDirectory, ICloudBuild cloudBuild, Nullable`1 overrideBuildNumberOffset, String projectPathRelativeToGitRepoRoot) [/src/src/BaGet.Core/BaGet.Core.csproj]
/root/.nuget/packages/nerdbank.gitversioning/2.2.13/build/Nerdbank.GitVersioning.targets(63,5): error MSB4018:    at Nerdbank.GitVersioning.Tasks.GetBuildVersion.ExecuteInner() [/src/src/BaGet.Core/BaGet.Core.csproj]
    0 Warning(s)
    1 Error(s)

Time Elapsed 00:00:02.16
The command '/bin/sh -c dotnet build src/BaGet -c Release -o /app' returned a non-zero code: 1

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
jeanczcommented, Nov 29, 2018

Yes, it is working now. Thanks 😃

0reactions
loic-sharmacommented, Nov 28, 2018

Did updating your project fix the issue?

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to debug build failures - DockerEngine
In short, look at the container ID of the failed step, then commit that to a temporary image, then run 'sh' (or 'env'...
Read more >
How can I inspect the file system of a failed `docker build`?
Everytime docker successfully executes a RUN command from a Dockerfile, a new layer in the image filesystem is committed.
Read more >
How to solve the error 'Failed to build the docker image ...
This error message typically indicates that there was an issue building the Docker image for your project. To troubleshoot the problem, you can...
Read more >
Docker image build failed - GitLab CI/CD
CI says that it cannot find the jar file during docker build. But the jar file is there when I do an ls...
Read more >
Failed to build docker image with the Dockerfile · Issue #5499
Tried to build a docker image with the command : docker image build -t aws-cdk:1.0 . But failed with the following error.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found