如何使Shell脚本指向.dll?(Docker ENTRYPOINT) [英] How can I have a shell script point to a .dll? (Docker ENTRYPOINT)
问题描述
我正在使用Docker部署.NET Core应用程序.默认情况下,应用程序的DockerFile中的 ENTRYPOINT
类似于:
I am using Docker to deploy a .NET Core application. By default, the ENTRYPOINT
in the DockerFile for an application is something like:
ENTRYPOINT ["dotnet","applicationStartingPoint.dll"]
但是,在应用程序启动之前,我需要在容器中执行shell脚本.为此, CMD
名称不适用于我,因此我需要将shell脚本用作 ENTRYPOINT
,然后通过DLL启动该应用程序.
However, I need to have a shell script execute in the container before the application begins. The CMD
designation is not working for me for this purpose, so I need to have a shell script as my ENTRYPOINT
and then have that start the application by the DLL.
您可以提供的任何见解将大有裨益.
Any insight you could provide would be greatly beneficial.
推荐答案
您可以简单地创建一个名为 entrypoint.sh
的脚本.在此脚本中,您可以执行所需的任何操作,然后调用命令以启动应用程序.所以:
You can simply create a script called entrypoint.sh
. Inside of this script you can do whatever you want, then call the command to start the application. So:
entrypoint.sh :
#!/usr/bin/env sh
... my crazy pre-script
dotnet applicationStartingPoint.dll
Dockerfile :
COPY entrypoint.sh /entrypoint.sh
RUN chmod +x /entrypoint.sh
ENTRYPOINT ["/entrypoint.sh"]
更新:我已向Dockerfile添加了如何在构建文件时将文件复制到容器并提供必要的权限.
UPDATE: I've added to the Dockerfile how you can copy the file to the container while building it and also give the necessary permissions.
这篇关于如何使Shell脚本指向.dll?(Docker ENTRYPOINT)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!