Writing to Bind Mount Inside of an Unprivileged Container?

In an LXC container with Ubuntu 22.04 I had problems with the root user.
If I gave a command that required root permissions, such as
Code:
apt-get update
, it would give an error concerning the UID
I solved this by adding two lines in the container's conf file:

Code:
lxc.idmap = u 65534 165534 1
lxc.idmap = g 65534 165534 1

Is there a better way to do the same thing or is this correct?