Very slow start using Gogs' Docker image



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!


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



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

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


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


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.


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.


Here it is:

Thank you, in advance!


Hi, can you tell us where that line is located in order to disable it.
While the Gogs team works with the permanent solution I need to startup gogs again.

Thank you