Official gogs permission problems on synology docker


I am having problems running dockerized gogs (official image) on my synology DS918+. I already posted this in the gogs forums, but got no support. I was hoping somebody here might be able to help me out. This is the original post (link to docker forums:

I am running the latest gogs version (Gogs Version: on my Synology NAS 918+ as a docker container. Set up worked fine. I have a mariadb database (also dockerized) running on the same machine and they connected.
The docker image is gogs/gogs:latest. I have linked a local folder to /data, which is in rw mode.

Gogs is set up, connected to my database and I am logged in in my browser. I can create a repository and I can git remote add it in the terminal.
I can also git add and git commit my files, however, git push -u origin master will not work.
This error pops up:

Counting objects: 1288, done.
Delta compression using up to 8 threads.
Compressing objects: 100% (1194/1194), done.
remote: fatal: Unable to create temporary file ‘/data/git/gogs-repositories/me/.dotfiles.git/./objects/incoming-> NlcdkC/pack/tmp_pack_XXXXXX’: Permission denied
error: RPC failed; HTTP 500 curl 22 The requested URL returned error: 500 Internal Server Error
Writing objects: 100% (1288/1288), 31.87 MiB | 13.60 MiB/s, done.
Total 1288 (delta 271), reused 0 (delta 0)
error: remote unpack failed: index-pack abnormal exit
Everything up-to-date

The above error happens when I used git remote add origin http://myip:port/me/.dotfiles.git; ssh will not work either. When I git remote add origin ssh://git@myip:port/me/.dotfiles.git, I get this error:

The authenticity of host ‘[ip]:port ([ip]:port)’ can’t be established.
ECDSA key fingerprint is .
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added ‘[ip]:port’ (ECDSA) to the list of known hosts.
Enter passphrase for key ‘/Users/me/.ssh/id_rsa’:
Counting objects: 1297, done.
Delta compression using up to 8 threads.
Compressing objects: 100% (1202/1202), done.
remote: fatal: Unable to create temporary file ‘/data/git/gogs-repositories/me/.dotfiles.git/./objects/incoming-PBiPMB/pack/tmp_pack_XXXXXX’: Permission denied
error: remote unpack failed: index-pack abnormal exit
error: failed to push some refs to ‘ssh://git@ip:port/me/.dotfiles.git’

When I ssh into my synology and move to the gogs config directory, I get these user permissions:
drwxr-xr-x 1 1000 1000 504 Oct 10 13:10 gogs
All subdirectories are also owned by user 1000 and group 1000. I manually changed them to user docker and the appropriate group manually, but no success.

What am I doing wrong? Until now, I was running gogs dockerized on my macbook and everything worked perfectly. I did not have any problems with permissions at all. gogs itself is running as user git, which I assume is only relevant within the docker container…?

I tried setting a different user (gogs) during initial setup, but no other user besides git was able to finish the initial setup.

Any help is greatly appreciated :slight_smile:

I know this is an old and unanswered post…

This issue occurs on systems with SELinux enforcing. Assuming that the volume that you are mapping to /data is also owned by uid:gid 1000:1000, then all you need to do is add :z to the end of the volume mapping, as in:

-v /path/to/data:/data:v