By Fatskills Exam Guides Team — the exam nerds behind 28,500+ quizzes and 2.1M practice questions across 500+ global exams.
Seccomp and AppArmor Profiles restrict container processes to prevent privilege escalation and improve security. Use the --security-opt flag to specify profiles.
--security-opt
2. Build the Docker image. ```bash docker build -t myimage .
4. ⚠️ Delete all stopped containers. ```bash docker container prune
6. Build the Docker image with the Seccomp profile. ```bash docker build -t myimage .
8. Create a new Dockerfile with the `--security-opt` flag to specify an AppArmor profile. ```bash echo "FROM alpine:latest" > Dockerfile echo "RUN echo 'Hello World'" >> Dockerfile echo "security-opt apparmor:unconfined" >> Dockerfile
10. Run the container with the AppArmor profile. ```bash docker run -it --rm --security-opt apparmor:unconfined myimage
Purpose: Restrict container processes to prevent privilege escalation.Command: docker run -it --rm --security-opt seccomp:unconfined myimage Flags: --security-opt seccomp:unconfined specifies the Seccomp profile.
docker run -it --rm --security-opt seccomp:unconfined myimage
--security-opt seccomp:unconfined
Purpose: Restrict container processes to prevent privilege escalation.Command: docker run -it --rm --security-opt apparmor:unconfined myimage Flags: --security-opt apparmor:unconfined specifies the AppArmor profile.
docker run -it --rm --security-opt apparmor:unconfined myimage
--security-opt apparmor:unconfined
Purpose: Restrict container processes to prevent privilege escalation using a custom Seccomp profile.Command: docker run -it --rm --security-opt seccomp=/path/to/custom/seccomp.json myimage Flags: --security-opt seccomp=/path/to/custom/seccomp.json specifies the custom Seccomp profile.
docker run -it --rm --security-opt seccomp=/path/to/custom/seccomp.json myimage
--security-opt seccomp=/path/to/custom/seccomp.json
Error message: Error: Unknown seccomp profile: unconfined Why it happens: The Seccomp profile is not recognized by Docker.One-line fix: docker run -it --rm --security-opt seccomp:default myimage
Error: Unknown seccomp profile: unconfined
docker run -it --rm --security-opt seccomp:default myimage
Error message: Error: Unknown apparmor profile: unconfined Why it happens: The AppArmor profile is not recognized by Docker.One-line fix: docker run -it --rm --security-opt apparmor:runtime/default myimage
Error: Unknown apparmor profile: unconfined
docker run -it --rm --security-opt apparmor:runtime/default myimage
Error message: Error: Seccomp profile not found: /path/to/custom/seccomp.json Why it happens: The custom Seccomp profile is not found.One-line fix: docker run -it --rm --security-opt seccomp=/path/to/default/seccomp.json myimage
Error: Seccomp profile not found: /path/to/custom/seccomp.json
docker run -it --rm --security-opt seccomp=/path/to/default/seccomp.json myimage
Situation: You want to check the Seccomp profile used by a container.Command: docker inspect --format='{{.Config.SecurityOpt}}' myimage Correct response: seccomp:unconfined
docker inspect --format='{{.Config.SecurityOpt}}' myimage
seccomp:unconfined
Situation: You want to check the AppArmor profile used by a container.Command: docker inspect --format='{{.Config.SecurityOpt}}' myimage Correct response: apparmor:unconfined
apparmor:unconfined
Situation: You want to check the security options used by a container.Command: docker inspect --format='{{.Config.SecurityOpt}}' myimage Correct response: seccomp:unconfined apparmor:unconfined
seccomp:unconfined apparmor:unconfined
Join 4M+ learners. Unlock unlimited quizzes, wrong-answer tracking, flashcards + reminders, study guides, and 1-on-1 challenges.