Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to run docker commands #542

Open
lymberl opened this issue Jan 25, 2024 · 5 comments
Open

How to run docker commands #542

lymberl opened this issue Jan 25, 2024 · 5 comments

Comments

@lymberl
Copy link

lymberl commented Jan 25, 2024

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

@baronfel
Copy link
Member

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.

@lymberl
Copy link
Author

lymberl commented Jan 29, 2024 via email

@lymberl
Copy link
Author

lymberl commented Jan 31, 2024

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

@lymberl
Copy link
Author

lymberl commented Jan 31, 2024

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.

@clement128
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants