Change default username in docker container


#1

Hi,

I managed to run urbackup in a docker container ( but I had issues with symbolic links and SMB …).
I had issues with mounting the filesystem from my host to the container. The problem is, that normally the mount from docker will get the same permissions as from the host system. In my case its a SMB share. The local user within the docker container is urbackup with UID=101 und GID=101. This is kinda unlucky as for example on Ubuntu GID and UID 101 are used by systemd. It would be awesome if we could change that GID and GID to a higher value.
Thanks for the great software btw!


#2

Same here. My system is set up for the ‘standard’ convention of passing user/group as PUID/PGID to the docker container. Could it be possible to use this here as well? Would make things easier to transition from regular to docker-based setup. :slight_smile:


#3

Could you provide more details on how this works (e.g. an example)?

Or simply make a pull request to https://github.com/uroni/urbackup-server-docker


#4

Hi @uroni
when you run the docker container your user UID and the users group ID are only linked to that container. So you can literally have the any UID/GID set for your urbackup-server user. In this case you have decided to use 101.
When you run in a dockerized environment you have very often multiple container running. Depending on your server this can either be local storage or storage from a NAS mounted (I use iSCSI). You want to pass persistent storage from the host where you run the docker container to the urbackup-docker-instance (-v option). That allows you start a new instance of urbackup when you e.g. update urbackup.

Anyhow I had a look at your documentation and also to your dockerfile. As you have mentioned in your documentation " -v /media/backups:/backups"
indicates that docker will create a persistant volume in the root directory of yourt docker installation (for example /etc). If you now only have a thumb drive with 64GB to boot from and you do start to backup one single machine, your volume would be completely full. Therefore you can specify custom path outside of the default path where you have mounted another disk to, or iSCSI or whatever. But if you mount a volume you do that either with root (GID=0) or another user. Often you do run the dockerd with a specific user only for running docker. In that case you would not be able to pass the mountpoint to the docker container, as a 1:1 mapping is done by the docker deamon to pass-tru that volume/path from the host machine. If you now the docker containers user “urbackup” want to write to “/backup” he will get an access denied. You have to mount the mountpoint with the same UID/GID as the user in the container which wants to write to it. Normally this is not a problem, as the hosts mountpoint is dedicated to a user and a purpose.

TL;DR
Nothing is wrong with your Dockerfile and documentation. If you want to solve the problem, you have to set another UID and GID for the default user “urbackup”. This can be a random number, for example 1109 or 9046. But nothing that is used by a linux/unix system by default, which can be something between 0-999.

Hope this helps.
Best,
IceBoosteR