1. Learn
  2. /
  3. Courses
  4. /
  5. Introduction to Docker

Exercise

Be safe, don't use root

Not giving access to the root user in your images makes images more foolproof, as users only have access to what's relevant to the use case you intended for the image. Additionally, it is one of the best options to increase their security. We've built an image for you from the following Dockerfile, which tries to install python3 as soon as you start it.

FROM ubuntu
RUN useradd -m repl
USER repl
CMD apt-get install python3

Let's see what happens if we try to install python3 at startup as the repl user.

Instructions

100 XP
  • Use docker to run the repl_try_install image.