From the course: Certified Kubernetes Security Specialist (CKS) Cert Prep

Unlock this course with a free trial

Join today to access over 24,900 courses taught by industry experts.

Reduce image attack surface

Reduce image attack surface

- In this demonstration, we're going to take a look at being able to provide some security settings within our Docker environment, so that when we're building these docker containers, that we have the ability to be able to set certain parameters like read-only file system as well as the application user. Let's start off by being able to ensure that we are not running as a root user. And this one's going to require that we are going to do a build that has the ability to be able to minimize the use of that, that root container. So, let's go ahead and take a look at our Docker file here. So, this is a non-root or no root Docker file. And as you can see here, what we've added to our previous example, we're still using the same app, we're still using the same process, but we're going to add a user and then a group, and then be able to set the user and group to appgroup and appuser. Now this one, we go do the build. It should allow us to be able to make this particular container non-root…

Contents