Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I have a shell script point to a .dll? (Docker 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"]

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.

like image 822
mkulak Avatar asked Oct 31 '25 00:10

mkulak


1 Answers

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"]

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.

like image 104
Joao Cunha Avatar answered Nov 01 '25 13:11

Joao Cunha



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!