AZ-800 · Question #254
You have a Windows Server container host named Server1. You create a Dockerfile named df1. You need to generate a container image by using df1. Which command should you run?
The correct answer is A. docker build. 'docker build' is the command used to create (build) a container image from a Dockerfile. You specify the Dockerfile using the '-f' flag (e.g., 'docker build -f df1 .'), and Docker processes the instructions in the file to assemble the image layer by layer. The other commands…
Question
You have a Windows Server container host named Server1. You create a Dockerfile named df1. You need to generate a container image by using df1. Which command should you run?
Options
- Adocker build
- Bdocker exec
- Cdocker create
- Ddocker images
How the community answered
(58 responses)- A91% (53)
- B2% (1)
- C5% (3)
- D2% (1)
Explanation
'docker build' is the command used to create (build) a container image from a Dockerfile. You specify the Dockerfile using the '-f' flag (e.g., 'docker build -f df1 .'), and Docker processes the instructions in the file to assemble the image layer by layer. The other commands serve different purposes: 'docker exec' runs a command inside an already-running container; 'docker create' creates a container from an existing image without starting it; 'docker images' lists locally stored images. None of these build an image from a Dockerfile.
Topics
Community Discussion
No community discussion yet for this question.