wayground logo

Free Printable Worksheets

NEW

Font size

S
M
L
XL
Worksheets

Getting Started with Docker and Dockerfile

Total questions: 47

Worksheet time: 35mins

Name
Class
Date
1.

Key benefits of Docker for web developers includes:

a)

Consistency between envionments.

b)

Simplify working with multiple framework versions.

c)

Setup a development environment quickly.

d)

All of these.

e)

Ship code faster.

2.

Which of following statements is untrue about Docker.

a)

By default, Docker doesn't create containers in user namespaces because not all Linux distributions enable user namespace sin their kernel.

b)

User namespaces allow a container's process to be privileged in its own user namespace, whilst remaining non-privileged in the host's user namespace.

c)

Docker creates a sub-directory in its data root so that newly created objects are owned by the UID/GID at the top of the docker-remap user's subordinate ranges.

3.

Which of the following statements regarding the ephemerality of containers is FALSE?

a)

Containerized applications tend to be easier to scale.

b)

Containers starts ridiculously fast.

c)

Containers require IT Ops to build individual instances.

d)

Containers can be packaged and instantiated directly from developer IDEs.

4.

How does the dockerd expose the Docker API?

a)

gRPC on a Unix socket.

b)

As a versioned HTTP(S) REST interface.

5.

What key concepts does Docker rely on?

a)

Images and containers

b)

Images and virtual machines

c)

Images and archives

d)

Virtual machines and LXC

6.

Docker containers can be started and stopped.

a)

True

b)

False

7.

Which component of the Docker implements the Docker API.

a)

The Docker daemon.

b)

The Docker client.

c)

containerd

d)

The OCI layer.

8.

What is the atomic unit of scheduling in Docker.

a)

the image

b)

the pod

c)

the job

d)

the container

e)

the process

9.

Which component of the Docker interfaces with the kernel primitives that are used to build containers?

a)

The Docker daemon

b)

The OCI layer (runc)

c)

The REST API

10.

Which of following statements is true about the architecture of Docker?

a)

The docker command executes REST API calls.

b)

All answers are true.

c)

The architecture is client-server.

d)

Docker containers are run as root.

e)

The daemon must be run as root.

11.

What is the general rule regarding running the Secure Shell (SSH) daemon inside a container.

a)

You can run SSH, but never allow sessions using the root user.

b)

Only use SSH version 2.0

c)

It is not recommended because a container should ideally run a single process.

d)

It is the recommended way to gain access to the terminal of a running container.

12.

What options are available for getting source code into Docker Containers?

a)

Use the Dockerfile "EMBEDCODE" instruction.

b)

Create a custom container with the source code and use the "mount" command to point to your dev machine.

c)

Create a custom docker image with the source code or create a data volume pointing to your dev machine.

d)

None of these.

13.

What is the name of the configuration file that describes how to build a new Docker image with your app-code inside.

a)

dockerfile.json

b)

docker-file

c)

dockerfile

d)

config.json

14.

The docker history command shows output similar to which of the following?

a)

docker layers

b)

docker-compose.yaml

c)

Dockerfile

d)

docker images

e)

docker ps

15.

You've been tasked with authoring a Dockerfile image which will encapsulate numerous networking tools which will be used to troubleshoot communication between containers. Which Dockerfile instruction(s) is, or are, best suited for defining what a derived container will execute?

a)

The ENTRYPOINT instruction, because the CMD instruction requires the presence of /bin/bash, whereas the ENTRYPOINT instruction does not.

b)

A combination of the CMD and ENTRYPOINT instructions, because it's always necessary to provide a default execution parameter.

c)

The CMD instruction, because the image is multi-purpose in nature.

16.

What's the good analogy for docker exec?

a)

Allows you to run additional processes outside a container.

b)

Allows you to run additional processes in a container.

c)

It's similar to installing software.

d)

Allows you to run additional processes in new containers.

17.

What Dockerfile instruction must appear first in the file?

a)

IMAGE

b)

ENV

c)

FROM

d)

RUN

18.

Which Dockerfile instruction sets the default program for a container to run, but can be overridden on the CLI at runtime.

a)

ENTRYPOINT

b)

CMD

c)

RUN

19.

Which of the following Dockerfile instructions will define the process that keeps the container running? Commands defined using this instruction CANNOT be overridden at the command line during container initialization.

a)

ENTRYPOINT

b)

RUN

c)

CMD

d)

START

20.

What syntax can be used to convert a Dockerfile into an Image?

a)

docker create -t <image_name>:<tag_name> .

b)

docker build -t <image_name>:<tag_name> .

c)

docker run -t <image_name>:<tag_name> .

d)

docker convert -t <image_name>:<tag_name> .

21.

Which of the following characters is the default escape character in a dokcerfile.

a)

/

b)

\

c)

`

d)

#

22.

Each instruction in a Dockerfile creates an intermediate container as the image is built.

a)

True

b)

False

23.

What Dockerfile instruction can be used to execute npm install when creating a custom image>

a)

npm install

b)

RUN npm install

c)

None of these

d)

EXECUTE npm install

24.

What Dockerfile instruction can help correct for content root issues when building images for ASP.NET Core apps.

a)

RUN

b)

MKDIR

c)

WORKDIR

d)

CD

25.

Which Dockerfile instruction indicates what base image to use?

a)

ENTRYPOINT

b)

BASE

c)

FROM

d)

USING

26.

What is a Dockerfile

a)

A text file.

b)

A container.

c)

An image.

d)

A binary file.

27.

What is the major advantage of the ADD instruction over the COPY instruction?

a)

The ADD instruction creates fewer layers than COPY.

b)

The COPY instruction is depricated.

c)

The COPY instruction has remote URL support.

d)

The ADD instruction has remote URL support.

28.

What happens if multiple ENTRYPOINT instructions are specified in one, single-stage Dockerfile?

a)

Only the first ENTRYPOINT instruction has any effect.

b)

The build will fail.

c)

All ENTRYPOINT instructions are processed in order and all have an effect on the container.

d)

Only the last ENTRYPOINT instruction has any effect.

29.

You use the EXPOSE instruction in the Dockerfile to set up containers to receive network traffic. Does that automatically publish container ports on the host?

a)

By default, the host machine will listen on all incoming ports.

b)

Yes, all ports in the EXPOSE instruction are automatically published.

c)

Only standard ports 80 and 443 are automatically published.

d)

No, you must explicitly publish ports to the host when you run a container.

30.

What is the function of the CMD instruction if the ENTRYPOINT instruction is also used?

a)

CMD instructions get ignored.

b)

CMD instructions override ENTRYPOINT instructions.

c)

CMD instructions get interpreted as arguments to ENTRYPOINT.

d)

CMD instructions are used to create the environment in which ENTRYPOINT instructions run.

31.

Where are created, modified, and deleted files stored in a container?

a)

In the top most layer from the image it was created from.

b)

In a volume mounted in the container

c)

In the bottom most layer from the image it was created from.

d)

In an R/W container layer.

32.

A Docker ________ has a "thin R/W layer."

a)

None of these

b)

Container

c)

File

d)

Image

33.

How many processes does a Linux-based Docker container normally run?

a)

One per image layer

b)

Two

c)

One

34.

Which of the following correctly describes a Docker container?

a)

A text file describing the dependencies of an application.

b)

An online registry of Docker images.

c)

An instance of an application created from a Docker image.

d)

A package consisting of an application and all its dependencies.

35.

You use EXPOSE instructions in Dockerfile to document which ports need mapping for your containerized applications to work. How can you launch containers from these images and automatically map exposed ports?

a)

Use the docker run command with the -expose-all runtime flag.

b)

Use the docker run command with the -map-all flag.

c)

Use the docker run command with the -P flag

d)

Use the docker run command with the --port runtime flag.

36.

Which command will map port 80 in the container to port 5001 on the Docker host?

a)

docker run -p 5001:80

b)

docker run -p 80:5001

c)

docker run expose 80:5001

d)

docker run expose 5001:80

37.

Which command allows you to access the live output of processes running inside a container?

a)

docker exec

b)

docker inspect

c)

docker run

d)

docker attach

38.

What command-line switch can be used to define a custom Dockerfile file name (such as dockerfile.node) when building a custom image?

a)

-v

b)

-f

c)

-t

d)

-customfile

39.

What format does Docker uses to export images?

a)

Image

b)

iso

c)

zip

d)

tar

e)

dmg

40.

Which Docker CLI commands can be used in a sequence to create a Docker image?

a)

docker container run, and docker container commit.

b)

docker container run, and docker image commit.

c)

docker container ls, and docker image commit.

d)

docker container diff, and docker container commit.

41.

Which of the following commands will successfully build an image with the name "myimage"?

a)

docker build -t myimage

b)

docker build --tag-image myimage

c)

docker build -n myimage .

d)

docker build -t myimage .

42.

Which of the following best describes a Docker Image?

a)

A read-only template for starting one or more containers.

b)

A data volume that can be mounted inside of a container.

c)

A point-to-time snapshot of a container used for backups.

d)

A read-write template for starting one or more containers.

43.

Which of the following docker commands will build a container image using instructions in a Dockerfile?

a)

docker commit create

b)

docker image create

c)

docker image build

d)

docker commit build

44.

What is a dangling image?

a)

An intermediate part of the chain of image layer.

b)

An image that's not associated with a tag.

c)

An image that's not associated with a volume.

d)

An image that's not associated with a running container.

45.

Which of the following explains the relationship between a Docker image and Docker container?

a)

A Docker container is used to start a Docker image.

b)

A Docker container is a running instance of an image.

c)

A Docker container is a collection of image layers.

d)

A docker container is two or more images that share a common execution environment.

46.

Docker Image consist of read-only layers.

a)

TRUE

b)

FALSE

47.

What is the purpose of an image?

a)

To provide a traditional process for an application.

b)

To provide the network configuration for an application's network stack.

c)

To provide the filesystem for an application.

d)

To provide an isolated process for an application.