profile
viewpoint

Ask questionsredis uid issue on ubuntu20.04

I'm trying to setup redis:6.2.3 container on my arm64 node running ubuntu 20.04. I see that the running container process gets the systemd-coredump user.

It appears the the systemd-coredump user on my node has the 999 uid. I modified the uid of the systemd-coredump user and added a redis user with 999 uid upon which the running container process showed ownership of redis user.

So the question, is it a good idea to modify the uid of the existing systemd-coredump and add redis user with uid 999?

docker-library/redis

Answer questions wglambert

The name of the user is basically just for readability and logging in, so with containers it's not so important. The processes running on the host which are running as the same UID wouldn't matter unless you're entwining them together in some way that they would be stepping over each other, like both reading/writing to the same volume mapping or something.

Basically redis' 999 UID shouldn't have any conflict with systemd-coredump's 999 UID (what with namespaces and all that). You can also run the container with --user to assign a different UID (but I wouldn't modify the host system processes UID's alternatively)

Example:

$ docker run -d --rm --name redis --user 1337:1337 redis
f7b298a864dc343c43da4e0f06d3a554b34217b7b95f6c946850a1243ec2d1d8

$ ps aux | grep redis
 4267 1337      0:00 redis-server *:6379

The usernames are different from host-container because they have completely separate environments, so while on your host it seems like it's running as systemd-coredump (according to /etc/passwd), the container's /etc/passwd is different.

An example with running a new container and modifying /etc/passwd to add a username to the UID to show the PID's username change

$ docker run -d --rm --name redis redis
54b4bc3a33af7d07c5d17ad1ac26cd971cb3125ca604b92daaf2140e5240afba

$ ps aux | grep redis
 7615 999       0:00 redis-server *:6379
 7692 root      0:00 grep redis

$ echo 'testuser:x:999:999:nobody:/:/sbin/nologin' >> /etc/passwd

$ ps aux | grep redis
 7615 testuser  0:00 redis-server *:6379
useful!
source:https://uonfu.com/
Github User Rank List