dotnet/sdk-container-builds

How to run docker commands

lymberl opened this issue · 5 comments

How would i run the following docker command before the ENTRYPOINT using the SDK Container Building Tools? But this is to basically set the image to use TLS v1.2 or below for the default .NET8 image (.NET8 Issue).

RUN sed -i '/[openssl_init]/a ssl_conf = ssl_sect' /etc/ssl/openssl.cnf

or

RUN sed -i '/[openssl_init]/a ssl_conf = ssl_sect' /etc/ssl/openssl.cnf
RUN printf "\n[ssl_sect]\nsystem_default = system_default_sect\n" >> /etc/ssl/openssl.cnf
RUN printf "\n[system_default_sect]\nMinProtocol = TLSv1.2\nCipherString = DEFAULT@SECLEVEL=0" >> /etc/ssl/openssl.cnf

You can set your own Entrypoint script + args with the ContainerAppCommand items - though another pathway would be to modify the SSL Conf file and mount that in during container execution via -v commands.

In general, the SDK Containers tech does not support RUN commands and cannot because it doesn't run a Linux VM, so we have to find alternative ways to accomplish the same goal.

I have added the following to the csproj file but it doesnt run the script
<ItemGroup Label="ContainerAppCommand Assignment"> <!-- Set the entrypoint to the setup script --> <ContainerAppCommand Include="bash" /> </ItemGroup> <ItemGroup> <ContainerAppCommandArgs Include="containersetupscript.sh" /> </ItemGroup>
and when i inspect the container it lists the following. It seems to also add the dotnet and dll as arguments even though i have not specified them.
"Path": "bash", "Args": [ "dotnet", "dotnetApp.dll", "containersetupscript.sh" ]

The logs end up displaying /usr/bin/dotnet: /usr/bin/dotnet: cannot execute binary file

if you add
<ItemGroup Label="ContainerAppCommand Assignment"> <!-- Set the entrypoint to the setup script --> <ContainerAppCommand Include="echo" /> </ItemGroup> <ItemGroup> <ContainerAppCommandArgs Include="containersetupscript.sh" /> </ItemGroup>
it will display dotnet dotnetApp.dll containersetupscript.sh. So it is adding dotnet and the dll name as arguments to the command which seems to be a bug.

@baronfel Can you be more specified or give an example? thanks in advance.