I have a GitLab instance in a Docker container running on a Synology NAS. Now, I want to move the GitLab to a Windows PC that I have, but keep the data on the NAS.
To do this, I created some folders config
, data
, and logs
on the NAS and shared them on the network with “Shared Folder”. From what I understand, this happens using Samba. Then, on the Windows machine, I run (based on Docker add network drive as volume on windows)
docker volume create --driver local
--opt type=cifs
--opt device=//192.168.1.150/gitlab_docker_volume/config
--opt o=user=gitlab_docker_volume,password=<password> gitlab-config
and two more to create gitlab-data
and gitlab-logs
.
Then, I start the container with
docker run -d -p 8070:80 -p 8433:443 -p 8012:22
-v gitlab-logs:/var/log/gitlab:rw
-v gitlab-data:/var/opt/gitlab:rw
-v gitlab-config:/etc/gitlab:rw gitlab/gitlab-ce
and it crashes with the error
...
Mixlib::ShellOut::ShellCommandFailed:
Failed asserting that ownership of "/var/opt/gitlab/git-data" was git:git
...
2024-12-13 13:54:47 + [ root:root = git:git ]
When I look into the folders on the NAS, I can see that the container successfully created all of the files and folders GitLab needs, but they all have owner gitlab_docker_volume:users
and 777 permissions. In the data
volume from the original GitLab container that is running on the NAS, the git-data
folder belongs to some mysterious user 998
and it has 2770
permissions.
I gather that what’s happening is that the GitLab container tries to chown
the git-data
folder and nothing happens because Windows doesn’t understand Linux permissions – the Docker container is basically writing Windows files and Windows then translates this to modifications on the NAS’ Linux files, ignoring the operations it doesn’t understand, such as chown
.
There are two posts about the same error, but they ran into it using different setups for their volumes – one of them seems to get the problem due to running the Windows server in a VM, the other one is using Windows-native folders.
Setting up Gitlab using Docker on Windows host, issue with shared folders
Volume trouble with GitLab docker image on Windows
I, on the other hand, have shared folders that are originally on a Linux machine. Is there some way I can change the folder share setup, the volume setup, or anything else, so that the container can change the user and permissions of the files?
Wider workarounds may be okay too. The only two things I really need are 1. for GitLab to be running on the Windows machine, because the NAS is too slow, 2. for its data to be on the NAS, in case the Windows PC dies suddenly.