Running a Dockerfile as a non-root user is a good practice for security reasons. By default, Docker runs containers with root privileges, but you can configure your Dockerfile to run as a non-root user.
RUN groupadd -r myappgroup && useradd -r -g myappgroup myappuser
COPY --chown:myappuser:myappgroup . .
In case you face any issues, feel free to leave a comment below and if you find this tutorial useful, follow our official channel on Telegram.