Complete the Dockerfile line to switch to a non-root user named 'appuser'.
USER [1]The USER instruction sets the user for running commands inside the container. Using appuser runs the container as a non-root user.
Complete the Dockerfile command to create a non-root user named 'appuser' with home directory.
RUN adduser --disabled-password --gecos '' [1]
The adduser command creates a new user. Here, 'appuser' is created without a password for safer container use.
Fix the error in the Dockerfile line to set ownership of /app directory to the non-root user 'appuser'.
RUN chown -R [1] /appChanging ownership to 'appuser:appuser' ensures the non-root user can access and modify /app safely.
Fill both blanks to run the container with user ID 1001 and group ID 1001.
docker run -u [1]:[2] myapp
The -u flag runs the container as a specific user and group ID. Using '1001:1001' runs as non-root user and group.
Fill all three blanks to create a Dockerfile snippet that creates a non-root user 'appuser', sets ownership of /app, and switches to that user.
RUN adduser --disabled-password --gecos '' [1] && \ chown -R [2] /app USER [3]
This snippet creates 'appuser', changes ownership of /app to 'appuser:appuser', and switches to 'appuser' to run the container safely as non-root.