【发布时间】:2018-07-16 15:38:16
【问题描述】:
我有以下 dockerfile:
# Build runtime image
FROM microsoft/aspnetcore:2.0
WORKDIR /app
COPY ./entrypoint.sh ./app/
RUN chmod +x ./app/entrypoint.sh
CMD /bin/bash ./app/entrypoint.sh
ENTRYPOINT ["dotnet", "test.dll"]
并希望 entrypoint.sh 正在执行。但我得到了错误:
Unhandled Exception: System.FormatException: Value for switch '/bin/bash ./app/entrypoint.sh' is missing.
Test | at Microsoft.Extensions.Configuration.CommandLine.CommandLineConfigurationProvider.Load()
Test | at Microsoft.Extensions.Configuration.ConfigurationRoot..ctor(IList`1 providers)
Test | at Microsoft.Extensions.Configuration.ConfigurationBuilder.Build()
Test | at Microsoft.AspNetCore.Hosting.WebHostBuilder.BuildCommonServices(AggregateException& hostingStartupErrors)
Test | at Microsoft.AspNetCore.Hosting.WebHostBuilder.Build()
Test | at Test.Program.Main(String[] args) in /app/Program.cs:line 19
Identity exited with code 139
这是什么意思:switch 的值丢失了,我怎样才能让它运行?感谢您的帮助
更新
请参阅此处:docker asp.net core container starting after a mysql container 了解更多信息。对不起,类似的第二个线程。请删除此贴
更新 2
这是我的 entrypoint.sh:
#!/bin/bash
set -e
echo -e "\nWaiting for the Database-Service..."
run_cmd="dotnet run --server.urls http://*:80"
until dotnet ef database update; do
>&2 echo "SQL Server is starting up"
sleep 1
done
>&2 echo "SQL Server is up - executing command"
exec $run_cmd
似乎 dotnet ef 数据库更新不起作用。所以我收到错误消息:
SQL Server is starting up
Test | Did you mean to run dotnet SDK commands? Please install dotnet SDK from:
Test | http://go.microsoft.com/fwlink/?LinkID=798306&clcid=0x409
这不是因为找不到 test.dll 而导致的错误吗?
【问题讨论】:
-
您想在容器中运行哪个命令:1.
/bin/bash ./app/entrypoint.sh或 2.dotnet test.dll或它们的某种组合? -
请张贴
entrypoint.sh的内容以澄清预期结果。 -
对不起第二个线程。请看这里:stackoverflow.com/questions/51359885/…
标签: docker docker-compose dockerfile