ExamGecko
Question list
Search
Search

List of questions

Search

Related questions











Question 239 - XK0-005 discussion

Report
Export

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?

A.
docker build -t myimage:1.0 .
Answers
A.
docker build -t myimage:1.0 .
B.
docker build -t myimage: .
Answers
B.
docker build -t myimage: .
C.
docker build -t myimage-1.0 .
Answers
C.
docker build -t myimage-1.0 .
D.
docker build -i myimage:1.0 .
Answers
D.
docker build -i myimage:1.0 .
Suggested answer: A

Explanation:

The docker build command is used to build an image from a Dockerfile and a context1.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 process1. 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 image1.The name and tag are separated by a colon (:), and the tag is usually used to indicate the version of the image2. 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 URL1.The dot (.) means that the current working directory is the context2. 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.

asked 02/10/2024
Peter Lilley
49 questions
User
Your answer:
0 comments
Sorted by

Leave a comment first