Я хочу реализовать простое приложение .net 4.7 с CNTK.CPUOnly и затем отправить его в Docker [Windows].
Шаги:
- Создатьновое консольное приложение .net 4.7 в Visual Studio 2017
- Откройте диспетчер NuGet и добавьте пакет CNTK.CPUOnly (с зависимостями)
- Напишите простое приложение:
</p>
<pre><code>using System;
using System.IO;
namespace cntk_docker
{
class Program
{
static void Main(string[] args)
{
var files = Directory.GetFiles(AppDomain.CurrentDomain.BaseDirectory);
foreach (var file in files)
{
Console.WriteLine(file);
}
var device = CNTK.DeviceDescriptor.CPUDevice;
Console.WriteLine(device);
Console.Read();
}
}
}
Затем я создал Dockerfile :
FROM microsoft/dotnet-framework:4.7
WORKDIR /app
COPY bin/x64/Release .
ENTRYPOINT ["cntk_docker.exe"]
Я получил исключение при попытке запустить приложение в Docker:
d:\codetest\cntk_docker>docker run 4e4d0888ae57
C:\app\Cntk.Composite-2.6.dll
C:\app\Cntk.Core-2.6.dll
C:\app\Cntk.Core.CSBinding-2.6.dll
C:\app\Cntk.Core.Managed-2.6.dll
C:\app\Cntk.Deserializers.Binary-2.6.dll
C:\app\Cntk.Deserializers.HTK-2.6.dll
C:\app\Cntk.Deserializers.Image-2.6.dll
C:\app\Cntk.Deserializers.TextFormat-2.6.dll
C:\app\Cntk.Math-2.6.dll
C:\app\Cntk.PerformanceProfiler-2.6.dll
C:\app\cntk_docker.exe
C:\app\cntk_docker.exe.Config
C:\app\cntk_docker.pdb
C:\app\libiomp5md.dll
C:\app\Microsoft.Win32.Primitives.dll
C:\app\mkldnn.dll
C:\app\mklml.dll
C:\app\netstandard.dll
C:\app\opencv_world310.dll
C:\app\System.AppContext.dll
C:\app\System.Collections.Concurrent.dll
C:\app\System.Collections.dll
C:\app\System.Collections.NonGeneric.dll
C:\app\System.Collections.Specialized.dll
C:\app\System.ComponentModel.dll
C:\app\System.ComponentModel.EventBasedAsync.dll
C:\app\System.ComponentModel.Primitives.dll
C:\app\System.ComponentModel.TypeConverter.dll
C:\app\System.Console.dll
C:\app\System.Data.Common.dll
C:\app\System.Diagnostics.Contracts.dll
C:\app\System.Diagnostics.Debug.dll
C:\app\System.Diagnostics.FileVersionInfo.dll
C:\app\System.Diagnostics.Process.dll
C:\app\System.Diagnostics.StackTrace.dll
C:\app\System.Diagnostics.TextWriterTraceListener.dll
C:\app\System.Diagnostics.Tools.dll
C:\app\System.Diagnostics.TraceSource.dll
C:\app\System.Diagnostics.Tracing.dll
C:\app\System.Drawing.Primitives.dll
C:\app\System.Dynamic.Runtime.dll
C:\app\System.Globalization.Calendars.dll
C:\app\System.Globalization.dll
C:\app\System.Globalization.Extensions.dll
C:\app\System.IO.Compression.dll
C:\app\System.IO.Compression.ZipFile.dll
C:\app\System.IO.dll
C:\app\System.IO.FileSystem.dll
C:\app\System.IO.FileSystem.DriveInfo.dll
C:\app\System.IO.FileSystem.Primitives.dll
C:\app\System.IO.FileSystem.Watcher.dll
C:\app\System.IO.IsolatedStorage.dll
C:\app\System.IO.MemoryMappedFiles.dll
C:\app\System.IO.Pipes.dll
C:\app\System.IO.UnmanagedMemoryStream.dll
C:\app\System.Linq.dll
C:\app\System.Linq.Expressions.dll
C:\app\System.Linq.Parallel.dll
C:\app\System.Linq.Queryable.dll
C:\app\System.Net.Http.dll
C:\app\System.Net.NameResolution.dll
C:\app\System.Net.NetworkInformation.dll
C:\app\System.Net.Ping.dll
C:\app\System.Net.Primitives.dll
C:\app\System.Net.Requests.dll
C:\app\System.Net.Security.dll
C:\app\System.Net.Sockets.dll
C:\app\System.Net.WebHeaderCollection.dll
C:\app\System.Net.WebSockets.Client.dll
C:\app\System.Net.WebSockets.dll
C:\app\System.ObjectModel.dll
C:\app\System.Reflection.dll
C:\app\System.Reflection.Extensions.dll
C:\app\System.Reflection.Primitives.dll
C:\app\System.Resources.Reader.dll
C:\app\System.Resources.ResourceManager.dll
C:\app\System.Resources.Writer.dll
C:\app\System.Runtime.CompilerServices.VisualC.dll
C:\app\System.Runtime.dll
C:\app\System.Runtime.Extensions.dll
C:\app\System.Runtime.Handles.dll
C:\app\System.Runtime.InteropServices.dll
C:\app\System.Runtime.InteropServices.RuntimeInformation.dll
C:\app\System.Runtime.Numerics.dll
C:\app\System.Runtime.Serialization.Formatters.dll
C:\app\System.Runtime.Serialization.Json.dll
C:\app\System.Runtime.Serialization.Primitives.dll
C:\app\System.Runtime.Serialization.Xml.dll
C:\app\System.Security.Claims.dll
C:\app\System.Security.Cryptography.Algorithms.dll
C:\app\System.Security.Cryptography.Csp.dll
C:\app\System.Security.Cryptography.Encoding.dll
C:\app\System.Security.Cryptography.Primitives.dll
C:\app\System.Security.Cryptography.X509Certificates.dll
C:\app\System.Security.Principal.dll
C:\app\System.Security.SecureString.dll
C:\app\System.Text.Encoding.dll
C:\app\System.Text.Encoding.Extensions.dll
C:\app\System.Text.RegularExpressions.dll
C:\app\System.Threading.dll
C:\app\System.Threading.Overlapped.dll
C:\app\System.Threading.Tasks.dll
C:\app\System.Threading.Tasks.Parallel.dll
C:\app\System.Threading.Thread.dll
C:\app\System.Threading.ThreadPool.dll
C:\app\System.Threading.Timer.dll
C:\app\System.ValueTuple.dll
C:\app\System.Xml.ReaderWriter.dll
C:\app\System.Xml.XDocument.dll
C:\app\System.Xml.XmlDocument.dll
C:\app\System.Xml.XmlSerializer.dll
C:\app\System.Xml.XPath.dll
C:\app\System.Xml.XPath.XDocument.dll
C:\app\zip.dll
C:\app\zlib.dll
Unhandled Exception: System.TypeInitializationException: The type initializer for 'CNTK.CNTKLibPINVOKE' threw an exception. ---> System.TypeInitializationException: The type initializer for 'SWIGExceptionHelper' threw an exception. ---> System.DllNotFoundException: Unable to load DLL 'Cntk.Core.CSBinding-2.6.dll': The specified module could not be found. (Exception from HRESULT: 0x8007007E)
at CNTK.CNTKLibPINVOKE.SWIGExceptionHelper.SWIGRegisterExceptionCallbacks_CNTKLib(ExceptionDelegate applicationDelegate, ExceptionDelegate arithmeticDelegate, ExceptionDelegate divideByZeroDelegate, ExceptionDelegate indexOutOfRangeDelegate, ExceptionDelegate invalidCastDelegate, ExceptionDelegate invalidOperationDelegate, ExceptionDelegate ioDelegate, ExceptionDelegate nullReferenceDelegate, ExceptionDelegate outOfMemoryDelegate, ExceptionDelegate overflowDelegate, ExceptionDelegate systemExceptionDelegate)
at CNTK.CNTKLibPINVOKE.SWIGExceptionHelper..cctor()
--- End of inner exception stack trace ---
at CNTK.CNTKLibPINVOKE.SWIGExceptionHelper..ctor()
at CNTK.CNTKLibPINVOKE..cctor()
--- End of inner exception stack trace ---
at CNTK.CNTKLibPINVOKE.DeviceDescriptor__CPUDevice()
at CNTK.DeviceDescriptor._CPUDevice()
at CNTK.DeviceDescriptor.get_CPUDevice()
at cntk_docker.Program.Main(String[] args) in D:\codetest\cntk_docker\cntk_docker\Program.cs:line 14
Но на моем локальном компьютере и любом другом компьютере win10 с .net4.7 он работает нормально.Что я не так сделал?