agenta
agenta copied to clipboard
[Bug] Agenta-cli does not grant sufficient access right when building from a Windows File System
Describe the bug For reasons obscure to me, when trying to build a variant from Windows (or WSL), the automatically created entrypoint.sh does not have execution permission. Meaning the server will fail to run the newly created image because of a
docker: Error response from daemon: failed to create shim task: OCI runtime create failed: runc create failed: unable to start container process: exec: "./deployment-service": permission denied: unknown.
To Reproduce Steps to reproduce the behavior:
- Locally host agenta 0.13.8 (in my case, a debian VM running agenta with forwarded ports)
- From either pure windows or WSL run
agenta init - Select local machine
- Select any template
- Run
agenta variant serve app.py
Expected behavior The container should be able to run, and the server return a 200.
Desktop (please complete the following information):
- OS: Windows 10 + WSL2 Ubutnu
I suspect adding a RUN ["chmod", "+x", "/entrypoint.sh"] to the Dockerfile template would be enough to fix this, but I'll be unable to reproduce for a few days.
I'm not used to opening issues, let me know if there's anything I can do to improve it :)
The issue you're experiencing with entrypoint.sh not having execution permissions when building from Windows or WSL is indeed related to how Docker handles file permissions across different operating systems. Your proposed solution to add RUN ["chmod", "+x", "/entrypoint.sh"] to the Dockerfile template is correct and should resolve the problem by ensuring the script is executable, regardless of the host system's file permissions.
This approach is a common workaround for permission issues encountered in Docker containers built on Windows systems, including WSL2. It ensures that the entrypoint.sh script can be executed within the container, which is necessary for the container to run properly. Implementing this change in the Dockerfile makes the script executable by all users but only writable by the owner, which is a good practice for balancing security and functionality.
Remember, adjusting file permissions is crucial in Docker environments, especially when working across different operating systems like Windows 10 or WSL2 Ubuntu, to avoid build and runtime issues. If you encounter further issues or have any questions, feel free to ask for more guidance.
Details
Sources
- agenta-cli/agenta/docker/docker-assets/entrypoint.sh
- agenta-cli/agenta/docker/docker-assets/Dockerfile.template
- agenta-web/prod.gh.Dockerfile
- docs/developer_guides/cli/install.mdx
- docs/advanced_guides/using_agenta_from_cli.mdx
About Dosu This response is meant to be useful and save you time. It is not meant to be a precise solution, but rather a starting point for your own research.
Help me be more useful! Please leave a 👍 if this is helpful and 👎 if it is irrelevant.
To continue the conversation, mention @dosu.
Can you specify where this change can be made? I am facing this issue
Hey @Arshil-Akkala, you would need to follow this guide to get started : Using agenta from CLI
On you're set up, insert RUN ["chmod", "+x", "/entrypoint.sh"] on line 10 of this Dockerfile template.
Let me know if that solves it for you :)
Thanks for the support @LucasTrg @aybruhm can we create a PR with this change, it should work on linux too.
We have published a new version with the fix proposed by @LucasTrg . Please pull the latest image (or clone the latest version of the repo) and try it again. Please let me know whether it fixes the issue @Arshil-Akkala
Hey @mmabrouk , thanks for extending your help. That issue appears to be fixed, but after the deploying the container successfully, I am facing another issue which I am unaware of the source.
Hi @Arshil-Akkala,
Are you using the latest version of agenta to serve the variant? If not, please try upgrading with this command:
pip install agenta --upgrade
If the issue persists, please add pymongo to your app requirements.txt file and trying re-serving your variant again. When you've done this and the issue has been resolved, let me know. Thank you.
Hey @aybruhm,
got another one, so while running it each time I should add these into
requirements.txt, any other alternative we have to make the changes in one go?
Thank you
A quick Update:
This fixed the issue I was facing.
Thanks again.
Hey @aybruhm,
got another one, so while running it each time I should add these into
requirements.txt, any other alternative we have to make the changes in one go? Thank youA quick Update:
This fixed the issue I was facing. Thanks again.
Hi @Arshil-Akkala,
Are you using CLI on development mode or using the agenta on pypi to serve your varians?
Hey @aybruhm,
got another one, so while running it each time I should add these into
requirements.txt, any other alternative we have to make the changes in one go? Thank you A quick Update:This fixed the issue I was facing. Thanks again.
Hi @Arshil-Akkala,
Are you using CLI on development mode or using the agenta on pypi to serve your varians?
Hey @aybruhm I am using CLI on development mode.
got another one, so while running it each time I should add these into
This fixed the issue I was facing.
Thanks again.