nerdexam
LPI

305-300 · Question #8

Which of the following values would be valid in the FROM statement in a Dockerfile?

The correct answer is A. ubuntu:focal. The FROM statement in a Dockerfile specifies the base image from which the subsequent instructions are executed. The value of the FROM statement can be either an image name, an image name with a tag, or an image ID. The image name can be either a repository name or a repository…

303.3 Application Security

Question

Which of the following values would be valid in the FROM statement in a Dockerfile?

Options

  • Aubuntu:focal
  • Bdocker://ubuntu: focal
  • Cregistry:ubuntu:focal
  • Dfile:/tmp/ubuntu/Dockerfile

How the community answered

(39 responses)
  • A
    79% (31)
  • B
    13% (5)
  • C
    5% (2)
  • D
    3% (1)

Explanation

The FROM statement in a Dockerfile specifies the base image from which the subsequent instructions are executed. The value of the FROM statement can be either an image name, an image name with a tag, or an image ID. The image name can be either a repository name or a repository name with a registry prefix. For example, ubuntu is a repository name, and docker.io/ubuntu is a repository name with a registry prefix. The tag is an optional identifier that can be used to specify a particular version or variant of an image. For example, ubuntu:focal refers to the image with the focal tag in the ubuntu repository. The image ID is a unique identifier that is automatically generated when an image is built or pulled. For example, sha256:9b0dafaadb1cd1d14e4db51bd0f4c0d56b6b551b2982b2b7c637ca143ad605d2 is an Therefore, the only valid value in the FROM statement among the given options is ubuntu:focal, which is an image name with a tag.

Topics

#Dockerfile#FROM statement#base image#container build

Community Discussion

No community discussion yet for this question.

Full 305-300 Practice