Run with Root User Privileges#

Flower Docker images, by default, run with a non-root user (username/groupname: app, UID/GID: 49999). Using root user is not recommended unless it is necessary for specific tasks during the build process.

Always make sure to run the container as a non-root user in production to maintain security best practices.

Run a Container with Root User Privileges#

-u 플래그를 사용하여 Docker 이미지를 실행하고 사용자 이름으로 ``root``를 지정합니다:

$ docker run --rm -u root flwr/superlink:1.11.1

이 명령은 루트 사용자 권한으로 Docker 컨테이너를 실행합니다.

Run the Build Process with Root User Privileges#

Docker 이미지 빌드 과정에서 루트 사용자로 전환하여 누락된 시스템 의존성을 설치하려면 Dockerfile 내에서 USER root 지시어를 사용할 수 있습니다.

SuperNode Dockerfile#
FROM flwr/supernode:1.11.1

# Switch to root user
USER root

# Install missing dependencies (requires root access)
RUN apt-get update && apt-get install -y <required-package-name>

# Switch back to non-root user app
USER app

# Continue with your Docker image build process
# ...