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

Database Containers Sample #473

Open
mick-anderson24 opened this issue Sep 18, 2024 · 2 comments
Open

Database Containers Sample #473

mick-anderson24 opened this issue Sep 18, 2024 · 2 comments

Comments

@mick-anderson24
Copy link

mick-anderson24 commented Sep 18, 2024

I've used this sample to implement the MSSql database container and pre-configure a database and table. The issue I have been running into is when the application starts and tries to spin up the MSSql database, it will intermittently fail to find the entrypoint.sh file. I would think copy and paste the entrypoint.sh file in this sample into my solution and it magically starts working again the next time I run it.

The error log in the container says it couldn't find the file entrypoint.sh even though the file didn't change nor did the name of the file. It seems to happen after I change branches from one that doesn't have this setup to the branch with these changes in it. Once I do that copy it works for the rest of the day Any ideas on why this happens?

Aspire console window:
fail: Aspire.Hosting.Dcp.dcpctrl.ContainerReconciler[0] could not determine host address and port for container port {"Container": {"name":"sqlserver-fbcgzhnc"}, "Reconciliation": 16, "error": "container '/sqlserver-fbcgzhnc' is not running: exited"} fail: Aspire.Hosting.Dcp.dcpctrl.ContainerReconciler[0] could not create Endpoint object {"Container": {"name":"sqlserver-fbcgzhnc"}, "Reconciliation": 16, "ServiceName": "sqlserver", "Workload": "/sqlserver-fbcgzhnc", "error": "container '/sqlserver-fbcgzhnc' is not running: exited"}

SqlServer container: 2024-09-18 12:33:13 exec /usr/config/entrypoint.sh: no such file or directory

@mick-anderson24
Copy link
Author

Solution structure for the AppHost:
image

Program.cs for AppHost:
image

entrypoint.sh file in AppHost
image

@DamianEdwards
Copy link
Member

Most issues with implementing this pattern I've seen are to do with inconsistent line endings and/or whitespace, and the execution bit not being set correctly on the entrypoint.sh file. Make sure you have your .gitattributes configured so that .sh files keep LF line endings and that the file itself is using spaces consistently. Also ensure the execute bit is properly set on the file and committed as such in git (this can be a tricky to do from Windows but if you search you'll find lots of references on how to fix it).

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

2 participants