0
0
Dockerdevops~10 mins

Distroless images concept in Docker - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the Dockerfile line to use a distroless base image for a Go app.

Docker
FROM gcr.io/distroless/[1]
Drag options to blanks, or click blank then click option'
Abase
Bnodejs
Cpython3
Dubuntu
Attempts:
3 left
💡 Hint
Common Mistakes
Choosing a full OS image like 'ubuntu' instead of distroless base.
2fill in blank
medium

Complete the Dockerfile line to copy the binary into the distroless image.

Docker
COPY [1] /app/
Drag options to blanks, or click blank then click option'
Amain.go
Bapp_binary
Capp
DDockerfile
Attempts:
3 left
💡 Hint
Common Mistakes
Copying source code files instead of the compiled binary.
3fill in blank
hard

Fix the error in the Dockerfile command to run the app in a distroless image.

Docker
CMD ["[1]"]
Drag options to blanks, or click blank then click option'
Abash
B/usr/bin/python3
C/app/app_binary
D/bin/sh
Attempts:
3 left
💡 Hint
Common Mistakes
Trying to run shell commands in distroless images.
4fill in blank
hard

Fill both blanks to create a multi-stage Dockerfile using distroless.

Docker
FROM golang:1.20 AS builder
WORKDIR /app
COPY . .
RUN go build -o [1] .

FROM gcr.io/distroless/[2]
COPY --from=builder /app/[1] /app/[1]
Drag options to blanks, or click blank then click option'
Aapp_binary
Bbase
Cnodejs
Dmain.go
Attempts:
3 left
💡 Hint
Common Mistakes
Using source file names or wrong distroless variants.
5fill in blank
hard

Fill all three blanks to complete the Dockerfile for a distroless Node.js app.

Docker
FROM node:18 AS build
WORKDIR /app
COPY package.json package-lock.json ./
RUN npm install
COPY . .
RUN npm run build

FROM gcr.io/distroless/[1]
COPY --from=build /app/[2] /app/[2]
CMD ["[3]", "/app/[2]/index.js"]
Drag options to blanks, or click blank then click option'
Anodejs
Bdist
Cnode
Dbase
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'base' image for Node.js or wrong CMD command.