Very slow start using Gogs' Docker image


#1

Hello!

When using Gogs with Docker (current image: gogs/gogs:0.11.53), whenever I restart or upgrade the container, it takes a huge amount of time to finish the starting process. I believe that it happens because of a chown process that takes place when the container is starting.

I’ve been using Gogs for some time, and although I understand the need for changing file permissions initially, the bigger our repository gets, the longer it takes for the process to finish. And since I’m using a fixed volume for the repository files, it might not be really necessary to change all the files all the time. So I’m wondering if there’s any way to avoid triggering the chown at the container’s startup, or if it can be stopped without compromising the service’s functionality.

Thank you in advance!


#2

Hi, if you have found out, could you pin point which chown is causing the problem?


#3

Hello!

It seems to be the command that runs on this file. Specifically, this line:

chown -R git:git /data /app/gogs ~git/


#4

Thanks! But I wonder there will be permission issue without this line…


#5

I’m also not sure, but I’m assuming that Gogs already creates files and directories with the correct permissions without depending on that command. It might be good to run that line on the container’s first run, if necessary or if the correct owner/group is not already set on specific files, but not on every restart.


#6

I think I don’t have enough knowledge to say if it’s safe to remove that line… could you open an issue on GitHub about this, I’ll do some tests when I have time.


#7

Here it is: https://github.com/gogs/gogs/issues/5316

Thank you, in advance!