Modmail icon indicating copy to clipboard operation
Modmail copied to clipboard

[BUG]: Unable to create folder in docker container

Open tim-schneider opened this issue 2 years ago • 5 comments

Bot Version

v4.1.0

How are you hosting Modmail?

Other

Error Logs

https://www.toptal.com/developers/hastebin

Screenshots

PermissionError: [Errno 13] Permission denied: '/modmailbot/temp' Traceback (most recent call last): File "/modmailbot/bot.py", line 57, in <module> os.mkdir(temp_dir) PermissionError: [Errno 13] Permission denied: '/modmailbot/temp'

Additional Information

With v4.1.0 somehow my docker container has issues letting the Python script creating the temp folder within the modmailbot folder. I did modify the Python image to reflect my OS. And solved the issue with:

@@ -1,4 +1,4 @@
-FROM python:3.10 as py
+FROM arm64v8/python:3.11 as py

 FROM py as build

@@ -13,6 +13,8 @@ COPY --from=build /inst /usr/local

 ENV USING_DOCKER yes
 RUN useradd --system --no-create-home modmail
+RUN mkdir -p /modmailbot/temp
+RUN chown -R modmail:modmail /modmailbot
 USER modmail

 WORKDIR /modmailbot

tim-schneider avatar Nov 27 '23 21:11 tim-schneider

For me the logs are empty, can you try getting a new link? Screenshot_20231128_115532_Chrome

martinbndr avatar Nov 28 '23 10:11 martinbndr

BTW, if you just want to have a docker image for arm, you don't need to change the dockerfile, the current one (in the past, at least) builds on arm with no changes. You can even build directly from the git link without downloading anything.

khakers avatar Dec 05 '23 02:12 khakers

BTW, if you just want to have a docker image for arm, you don't need to change the dockerfile, the current one (in the past, at least) builds on arm with no changes. You can even build directly from the git link without downloading anything.

I assume you referencing the ghcr image. I just rented a plain hetzner arm64/v8:

root@debian-4gb-hel1-2:~# docker run -it ghcr.io/modmail-dev/modmail:master
WARNING: The requested image's platform (linux/amd64) does not match the detected host platform (linux/arm64/v8) and no specific platform was requested
docker: Error response from daemon: AppArmor enabled on system but the docker-default profile could not be loaded: running `apparmor_parser apparmor_parser --version` failed with output:
error: exec: "apparmor_parser": executable file not found in $PATH.
ERRO[0000] error waiting for container: context canceled

tim-schneider avatar Dec 07 '23 23:12 tim-schneider

For me the logs are empty, can you try getting a new link?

Sorry, there aren't any other logs than what I have provided. Sadly it form did force me to put in a link.

PermissionError: [Errno 13] Permission denied: '/modmailbot/temp' Traceback (most recent call last): File "/modmailbot/bot.py", line 57, in <module> os.mkdir(temp_dir) PermissionError: [Errno 13] Permission denied: '/modmailbot/temp'

tim-schneider avatar Dec 07 '23 23:12 tim-schneider

No as I said, you just need to build the image on your machine. The python:3.10 image is a multiplatform one with support for linux/arm64/v8. You do not need to modify the dockerfile in any way to get an arm64/v8 build.

Alternatively, modmail could supply a multiplatform image with arm support so this whole song and dance doesn't have to be done.

khakers avatar Dec 08 '23 22:12 khakers

The project's Dockerfile has been updated to fix the issue.

Taaku18 avatar May 15 '24 11:05 Taaku18