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.
Latihan ini adalah bagian dari kursus
Introduction to Docker
Petunjuk latihan
- Use
dockerto run therepl_try_installimage.
Latihan interaktif praktis
Ubah teori menjadi tindakan dengan salah satu latihan interaktif kami.
Mulai berolahraga