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, by sharing folders and making them Docker volumes.
To test it, I created some folders config
, data
, and logs
on the NAS and shared them on the network with "Shared Folder". From what I understand, we have it configured to use SMB for this. Then, on the Windows machine, I run (based on this suggestion)
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.
If I understand correctly, what's happening is that the GitLab container tries to chown
the git-data
folder and this command would have to be mapped across the SMB/CIFS share, but that isn't happening.
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.
https://stackoverflow.com/questions/44684621/volume-trouble-with-gitlab-docker-image-on-windows
I've also tried to find out how to edit the Linux permissions through the network share in general, but the search results are flooded with "how to set the permissions when creating the folders so that the Docker container can edit them in the first place" - which was already working in my setup.
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? Docker is running with the WSL backend, by the way.