Well you technically DONT want the image to have a root user.
But a root user is the one that can install system packages.
The dockerfile is built to use the root user to update the system and install it’s packages just as much as you would update a linux system either with sudo or root. Then change the user to a NON root user and run the application.