[英]Could not run asp.net mvc 6 on Docker
我按照Visual Studio Code的指導來創建ASP.NET MVC應用程序。 我可以在本地(Windows 8)上運行它。 但是,當我嘗試將其發布到Docker時,問題就發生了。
我的dockerfile像
FROM microsoft/aspnet:1.0.0-beta4
#install npm in docker image
RUN apt-get update && apt-get install -y curl
RUN curl -sL https://deb.nodesource.com/setup | bash -
RUN apt-get install -y nodejs
#install bower and grunt
RUN npm install -g bower
RUN npm install -g grunt-bower-cli
RUN npm install -g grunt
RUN npm install -g grunt-cli
RUN npm install -g grunt-bower-task
COPY project.json /app/
WORKDIR /app
RUN ["dnu", "restore"]
COPY . /app
CMD ["cd", "/app/"]
CMD ["npm", "install"]
CMD ["bower", "install"]
EXPOSE 5001
ENTRYPOINT ["dnx", "kestrel"]
然后我試圖建立它
docker build -t thangchung/webdemo .
和
docker run -i -p 8080:5001 -t thangchung/webdemo
我在上面的代碼上運行的問題,它總是引發異常
System.InvalidOperationException: Unable to resolve project 'kestrel' from /app/kestrel
at Microsoft.Framework.Runtime.ApplicationHostContext..ctor (IServiceProvider serviceProvider, System.String projectDirectory, System.String packagesDirectory, System.String configuration, System.Runtime.Versioning.FrameworkName targetFramework, ICache cache, ICacheContextAccessor cacheContextAccessor, INamedCacheDependencyProvider namedCacheDependencyProvider, IAssemblyLoadContextFactory loadContextFactory, Boolean skipLockFileValidation) [0x00000] in <filename unknown>:0
at Microsoft.Framework.Runtime.DefaultHost.Initialize (Microsoft.Framework.Runtime.DefaultHostOptions options, IServiceProvider hostServices) [0x00000] in <filename unknown>:0
at Microsoft.Framework.Runtime.DefaultHost..ctor (Microsoft.Framework.Runtime.DefaultHostOptions options, IServiceProvider hostServices) [0x00000] in <filename unknown>:0
at Microsoft.Framework.ApplicationHost.Program.Main (System.String[] args) [0x00000] in <filename unknown>:0
at (wrapper managed-to-native) System.Reflection.MonoMethod:InternalInvoke (System.Reflection.MonoMethod,object,object[],System.Exception&)
at System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder,
System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00000] in <filename unknown>:0
誰能讓我知道為什么我不能在Docker上運行它?
任何建議都歡迎。 謝謝。
您是否從aspnet-docker github項目使用了正確的Docker映像?
有關在msdn上在Docker上運行ASP.NET 5的文章- 鏈接
編輯:
根據文章-您失蹤了
RUN ["kpm", "restore"]
在Dockerfile
。
2015年5月適合ASP.NET 5的文章: https : //alexanderzeitler.com/articles/Running-ASP.NET-5-beta4-in-Docker-with-DNX-runtime/
隨着從k到dnx的更新,您現在必須為包含project.json的目錄提供路徑參數。 那曾經是
k kestrel
變
dnx . kestrel
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.