OpenReservation / ReservationServer

预约系统 ReservationSystem powered by asp.net core
https://reservation.weihanli.xyz
MIT License
231 stars 89 forks source link

Docker can't run up #29

Closed ajeecai closed 4 years ago

ajeecai commented 5 years ago

git clone 项目,然后在项目根目录下sudo docker build -t booking:1 . ,完成之后,

~/github/ActivityReservation$ sudo docker run -p 80:80 booking:1 Unhandled exception. System.Threading.Tasks.TaskCanceledException: The operation was canceled. at System.Net.Http.ConnectHelper.ConnectAsync(String host, Int32 port, CancellationToken cancellationToken) at System.Net.Http.HttpConnectionPool.ConnectAsync(HttpRequestMessage request, Boolean allowHttp2, CancellationToken cancellationToken) at System.Net.Http.HttpConnectionPool.CreateHttp11ConnectionAsync(HttpRequestMessage request, CancellationToken cancellationToken) at System.Net.Http.HttpConnectionPool.GetHttpConnectionAsync(HttpRequestMessage request, CancellationToken cancellationToken) at System.Net.Http.HttpConnectionPool.SendWithRetryAsync(HttpRequestMessage request, Boolean doRequestAuth, CancellationToken cancellationToken) at System.Net.Http.RedirectHandler.SendAsync(HttpRequestMessage request, CancellationToken cancellationToken) at Microsoft.Rest.RetryDelegatingHandler.<>c__DisplayClass11_0.<b__1>d.MoveNext() --- End of stack trace from previous location where exception was thrown --- at Microsoft.Rest.RetryDelegatingHandler.SendAsync(HttpRequestMessage request, CancellationToken cancellationToken) at System.Net.Http.HttpClient.FinishSendAsyncBuffered(Task1 sendTask, HttpRequestMessage request, CancellationTokenSource cts, Boolean disposeCts) at Microsoft.Azure.KeyVault.KeyVaultClient.GetSecretWithHttpMessagesAsync(String vaultBaseUrl, String secretName, String secretVersion, Dictionary2 customHeaders, CancellationToken cancellationToken) at Microsoft.Azure.KeyVault.KeyVaultClientExtensions.GetSecretAsync(IKeyVaultClient operations, String secretIdentifier, CancellationToken cancellationToken) at Microsoft.Extensions.Configuration.AzureKeyVault.AzureKeyVaultConfigurationProvider.LoadAsync() at Microsoft.Extensions.Configuration.AzureKeyVault.AzureKeyVaultConfigurationProvider.Load() at Microsoft.Extensions.Configuration.ConfigurationRoot..ctor(IList`1 providers) at Microsoft.Extensions.Configuration.ConfigurationBuilder.Build() at Microsoft.Extensions.Hosting.HostBuilder.BuildAppConfiguration() at Microsoft.Extensions.Hosting.HostBuilder.Build() at ActivityReservation.Program.Main(String[] args) in /src/ActivityReservation/ActivityReservation/Program.cs:line 11

issue-label-bot[bot] commented 5 years ago

Issue-Label Bot is automatically applying the label bug to this issue, with a confidence of 0.72. Please mark this comment with :thumbsup: or :thumbsdown: to give our bot feedback!

Links: app homepage, dashboard and code for this bot.

WeihanLi commented 5 years ago

你直接在 web 项目下 dotnet run 可以吗? 感觉可能是你的网络不太好,默认启动的时候会去连国际版的 Azure 去拿一些配置信息,看错误是连接不上 azure key vault

ajeecai commented 5 years ago

对dotnet不熟悉,没有dotnet环境,所以直接用docker来运行...为何需要去Azure上拿配置,可以让用户自己配置或者hardcode在代码里面吗?换了一台云服务器试验,也是同样的错误。

WeihanLi commented 5 years ago

可以自己挂载配置文件,但是还有一些外部依赖,如 redis/es,想直接跑的话可以用单机版

docker run -d -p 8900:80 --name=reservation weihanli/activityreservation:standalone

详细参考:https://github.com/WeihanLi/ActivityReservation/blob/dev/docs/deploy/standalone.md

WeihanLi commented 4 years ago

@ajeecai 添加了 docker-compose,你可以克隆下来代码之后,直接在项目根目录下跑 docker-compose up 命令来启动

注:如果本地有redis 或 es 可能需要检查端口会不会冲突,container 名称是否冲突等

启动成功之后,在浏览器中打开: http://localhost:9080/Home/Notice 如果修改了端口,改成自己的端口即可看到网站的效果

image