Linux Foundation CKS Exam - Topic 1 Question 38 Discussion
Analyze and edit the given DockerfileFROM ubuntu:latestRUN apt-get update -yRUN apt-install nginx -yCOPY entrypoint.sh /ENTRYPOINT ["/entrypoint.sh"]USER ROOTFixing two instructions present in the file being prominent security best practice issuesAnalyze and edit the deployment manifest fileapiVersion: v1kind: Podmetadata:name: security-context-demo-2spec:securityContext:runAsUser: 1000containers:- name: sec-ctx-demo-2image: gcr.io/google-samples/node-hello:1.0securityContext:runAsUser: 0privileged: TrueallowPrivilegeEscalation: falseFixing two fields present in the file being prominent security best practice issuesDon't add or remove configuration settings; only modify the existing configuration settingsWhenever you need an unprivileged user for any of the tasks, use user test-user with the user id 5487
A) Explanation:
FROM debian:latest
MAINTAINER k@bogotobogo.com
# 1 - RUN
RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -yq apt-utils
RUN DEBIAN_FRONTEND=noninteractive apt-get install -yq htop
RUN apt-get clean
# 2 - CMD
#CMD ['htop']
#CMD ['ls', '-l']
# 3 - WORKDIR and ENV
WORKDIR /root
ENV DZ version1
$ docker image build -t bogodevops/demo .
Sending build context to Docker daemon 3.072kB
Step 1/7 : FROM debian:latest
---> be2868bebaba
Step 2/7 : MAINTAINER k@bogotobogo.com
---> Using cache
---> e2eef476b3fd
Step 3/7 : RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -yq apt-utils
---> Using cache
---> 32fd044c1356
Step 4/7 : RUN DEBIAN_FRONTEND=noninteractive apt-get install -yq htop
---> Using cache
---> 0a5b514a209e
Step 5/7 : RUN apt-get clean
---> Using cache
---> 5d1578a47c17
Step 6/7 : WORKDIR /root
---> Using cache
---> 6b1c70e87675
Step 7/7 : ENV DZ version1
---> Using cache
---> cd195168c5c7
Successfully built cd195168c5c7
Successfully tagged bogodevops/demo:latest
Jamal
10 months agoDenny
10 months agoOrville
10 months agoBlondell
11 months agoHillary
11 months agoAileen
11 months agoReita
11 months agoEarleen
11 months agoVeronika
12 months agoLasandra
12 months agoNell
12 months agoBette
1 year agoEladia
1 year agoTuyet
1 year agoTelma
1 year agoFrederic
1 year agoKindra
1 year agoRusty
1 year agoKasandra
1 year agoHildegarde
1 year agoAllene
1 year agoChauncey
1 year agoMohammad
1 year agoHelaine
1 year agoDianne
1 year agoNathalie
1 year agoFelicidad
1 year agoCandra
1 year agoRoxane
1 year agoLisha
1 year agoNathalie
1 year agoCarmela
1 year agoEdda
1 year agoAugustine
1 year ago