Complete the Dockerfile line to use a distroless base image for a Go app.
FROM gcr.io/distroless/[1]The base distroless image is a minimal image without a package manager or shell, ideal for Go apps.
Complete the Dockerfile line to copy the binary into the distroless image.
COPY [1] /app/You copy the compiled binary (e.g., app_binary) into the image, not source files.
Fix the error in the Dockerfile command to run the app in a distroless image.
CMD ["[1]"]
Distroless images do not have shells like /bin/sh. You must run the binary directly, e.g., /app/app_binary.
Fill both blanks to create a multi-stage Dockerfile using distroless.
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]
The binary is named app_binary and the distroless base image is base.
Fill all three blanks to complete the Dockerfile for a distroless Node.js app.
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"]
The distroless image for Node.js is nodejs, the build output folder is dist, and the command to run is node.