XK0-005 · Question #654
An application developer received a file with the following content: ##This is a sample Image ## FROM ubuntu:18.04 MAINTAINER [email protected] COPY . /app RUN make /app CMD python /app/app.py…
The correct answer is A. docker build -t myimage:1.0. The docker build command is used to build an image from a Dockerfile and a context. The Dockerfile is a text file that contains the instructions for creating the image, and the context is a set of files that can be used in the image creation process. The file that the developer…
Question
An application developer received a file with the following content:
##This is a sample Image ## FROM ubuntu:18.04 MAINTAINER [email protected] COPY . /app RUN make /app CMD python /app/app.py RUN apt-get update RUN apt-get install -y nginx CMD ["echo","Image created"] The developer must use this information to create a test bed environment and identify the image (myimage) as the first version for testing a new application before moving it to production. Which of the following commands will accomplish this task?
Options
- Adocker build -t myimage:1.0 .
- Bdocker build -t myimage: .
- Cdocker build -t myimage-1.0 .
- Ddocker build -i myimage:1.0 .
How the community answered
(30 responses)- A87% (26)
- B3% (1)
- C3% (1)
- D7% (2)
Explanation
The docker build command is used to build an image from a Dockerfile and a context. The Dockerfile is a text file that contains the instructions for creating the image, and the context is a set of files that can be used in the image creation process. The file that the developer received is an example of a Dockerfile. The -t option is used to specify a name and an optional tag for the image. The name and tag are separated by a colon (:), and the tag is usually used to indicate the version of the image. For example, -t myimage:1.0 means that the image will be named myimage and tagged as 1.0. The last argument of the docker build command is the path to the context, which can be a local directory or a URL. The dot (.) means that the current working directory is the context. Therefore, docker build -t myimage:1.0 . means that the image will be built from the Dockerfile and the files in the current working directory, and it will be named myimage and tagged as 1.0.
Topics
Community Discussion
No community discussion yet for this question.