Docker Practice Exams 4
Posted by Superadmin on July 12 2018 09:31:43

Docker Practice Exam 4

 

1) What is the default service mode on docker swarm, if not specified?

a) replicated

b) global

c) unified

d) standalone

 

2) What are the possible method(s) to deploy app containers on Docker EE?

a) deploy through UCP Web ui

b) deploy using docker client

c) deploy using kubectl

d) All of the above.

 

3) Which options can be added to reserve a given amount of memory and

number of CPUs for a service?

a) --limit-memory and --limit-cpu

b) --memory and --cpu

c) --reserve-memory and --reserver-cpu

d) -m and -c

 

4) Which option will enforce a service to only run on nodes with the label

“region” set to “east” and will fail if no appropriately labelled nodes are

available?

a) --constraint region==east

b) --region=east

c) --node-region=east

d) --label region=east

 

5) Which option will try to spread tasks evenly on every node which has a

“datacenter” node label attached to it, but will not fail if no appropriately

labeled nodes are available?

a) --constraint datacenter

b) --label datacenter

c) --placement-pref ‘spread=node.labels.datacenter’

d) --spread datacenter=

 

6) Which command will roll back to the previous version of the service

called “myapp”?

a) docker service update --rollback myapp

b) docker service rollback myapp

c) docker rollback service myapp

d) None of the above.

 

7) Which of the following command only removes stopped containers older

than 24 hours?

a) docker container prune

b) docker container rm --filter “until=24h”

c) docker rm --until 24h

d) docker container prune --filter “until=24h”

 

8) Which of the following commands will display information regarding the

amount of disk space used by the docker daemon?

a) df --filter docker

b) docker system df

c) docker disk usage

d) docker get diskusage

 

9) Which command can be used to get real-time events from the server?

a) docker system events

b) docker system logs

c) docker system realtime-events

d) docker system info

 

10) Which command can be used to ensure a worker node has successfully

joined a swarm, if run from the specified worker node?

a) docker node ls

b) docker swarm node

c) docker info

d) docker get node

 

11) Which command will display logs for a service called “helloapp”?

a) docker logs helloapp

b) docker service logs helloapp

c) docker get logs helloapp

d) docker logs --service helloapp

 

12) Which command when run on a manager, will list services running in

the swarm?

a) docker get service

b) docker list service

c) docker service ls

d) docker service list

 

13) Which port is used for communication between swarm nodes by

default?

a) 8080

b) 443

c) 21

d) 2377

 

14) If you have UCP clusters with 5 managers, how many managers can

you lose and still be able to schedule services?

a) 1

b) 2

c) 3

d) 4

 

15) Which command will allow us to inspect the build cache history of an

image?

a) docker image inspect <image id>

b) docker image cache <image id>

c) docker image history <image id>

d) docker image ls --cache

 

16) Which of the following instruction is not permitted to be used more

than once in a Dockerfile?

a) FROM

b) RUN

c) CMD

d) a and c

 

17) Which file, when present on context directory can increase the build’s

performance by excluding irrelevant files and directories specified on it?

a) .dockerignore

b) .gitexclude

c) .exlude

d) .skipthis

 

18) Which command will build an image and tag it into multiple

repositories?

a) docker build -t example/myapp:1.0.3:example/myapp:latest

b) docker build -t example/myapp:1.0.3 -t example/myapp:latest

c) docker build -t example/myapp:1.0.3 example/myapp:latest

d) docker build -t example/myapp:1.0.3:latest

 

19) Which Dockerfile instruction will add metadata to an image?

a) ARGS

b) ENV

c) LABEL

d) METADATA

 

20) Which Dockerfile instruction will inform Docker that the container

listens on the specified network ports at runtime?

a) EXPOSE

b) PORT

c) LISTEN

d) PUBLISH

 

21) Which Dockerfile instruction will tell Docker how to test a container to

check that it is still working?

a) TEST

b) LIVENESSPROBE

c) PROBE

d) HEALTHCHECK

 

22) What is the default logging driver for Docker service’s containers?

a) syslog

b) json-file

c) rsyslog

d) None of the above

 

23) Which command can be used to create a secret to be used by the swarm

Orchestrator?

a) docker secret create

b) docker new secret

c) docker add secret

d) docker secret add

 

24) Which of the following statements is incorrect?

a) A volume can be used by multiple containers

b) You can create a volume on the fly when you run new containers with -v

options

c) You can specify hostpath mount option on Dockerfile

d) You can specify the volume to be Read Only

 

25) Which command will create a service named “test-service” based on

“nginx:latest” image, that uses a volume named “myvol” mounted /app

inside the container?

a) docker service create --name test-service --mount

source=myvol,target=/app nginx:latest

b) docker service create --name test-service -v myvol:/app nginx:latest

c) docker service create --name test-service --volume myvol:/app

nginx:latest

d) b & c correct

 

26) Which network adapter will be used by default when you run “docker

network create mynetwork” without additional parameters?

a) overlay

b) overlay2

c) bridge

d) host

 

27) If containers “c1” are only attached to default network, container “c2”

only attached to “my_bridge” network and container “c3” attached to both

the default network and “my_bridge”. Which of the following statements is

true? ( Choose 3 answers )

a) c1 can reach c2 through it’s ipaddress

b) c2 can reach c3 through it’s hostname

c) c1 can reach c3 through it’s hostname

d) c3 can reach c1 through it’s ipaddress

 

28) Which command can be use to list the published ports of a container? (

Choose 3 answers)

a) docker port

b) docker ps

c) docker network

d) docker container inspect

 

29) Which command can be used to remove an existing network named

“my_bridge”?

a) docker rm my_bridge

b) docker rmi my_bridge

c) docker network rm my_bridge

d) docker rm --network my_bridge

 

30) Which command will connect the specified container to the specified

network after the container is running?

a) docker network connect <network name> <container name or id>

b) docker network attach <network name> <container name or id>

c) docker create network <network name> <container name or id>

d) docker network add <network name> <container name or id>

 

31) Which command will change the certificate rotation period from the

default of 90 days (168 hours) to one week, and rotate the certificate now?

a) docker swarm ca --rotate-cert 168h

b) docker swarm ca --rotate --cert-expiry 168h

c) docker ca --rotate --cert-expiry 168h

d) docker rotate ca --cert-expiry 168h

 

32) Which command will promote two worker node named “node-a” and

“node-b” into manager nodes?

a) docker node node-a node-b --promote

b) docker node node-a promote node-b

c) docker node modify node-a node-b role=manager

d) docker node promote node-a node-b

 

33) If you run “docker network create --driver overlay my_overlay”, when

does the driver actually created on the swarm nodes?

a) It will be created on all nodes only when the command is executed. So it

won’t be available on new nodes created after.

b) When the command is executed and additionally created when new

worker nodes are added.

c) When the service that is using “my_overlay” is scheduled on a node, the

driver will be created on the specified node.

d) None of the above

 

34) Which of the following are the 3 main Docker Container Network

Model components? (Choose 3 answers)

a) Sandbox

b) Endpoint

c) Network

d) Tunneling

 

35) Which command will create a container with custom DNS server(s)?

a) docker container create --dns=IP_ADDRESS

b) docker container create --dns=IP_ADDRESS

c) docker run --add-dns=IP_ADDRESS

d) docker container create --resolve=IP_ADDRESS

 

36) Which network driver is the best when you need containers running on

different Docker hosts to communicate?

a) macvlan

b) Host networks

c) Overlay networks

d) User-defined bridge networks

 

37) What is the Docker EE networking feature that allows you to specify

information in the HTTP header which UCP uses to route subsequent

requests to the same service task, for applications which require stateful

sessions?

a) Session Stickiness

b) HTTP Routing Mesh

c) Interlock

d) haproxy

 

38) What is the Docker EE networking feature that allows you to Publish a

service’s port and makes the service accessible at the published port on

every swarm node?

a) Session Stickiness

b) HTTP Routing Mesh

c) Interlock

d) haproxy

 

39) Which environment variable needs to be set on the OS to sign an image

before pushing it to the repository?

a) SIGN_DOCKER_IMAGE=1

b) DOCKER_IMAGE_SIGN=1

c) NOTARY_SIGNING=1

d) DOCKER_CONTENT_TRUST=1

 

40) Where is the Role Based Access Control configuration available?

a) docker client

b) docker swarm command

c) Universal Control Plane

d) b and c correct

 

41) Which of the following options when added to ‘docker container

inspect’ command will show JUST the IP address of a running container?

a) --show-ip

b) --format=”{{.NetworkSettings.Networks.bridge.IPAddress}”

c) --limit=IPAddress

c) None of the above.

 

42) Which tools can be used to deploy multiple containers using one

configuration file without creating a cluster?

a) kubernetes

b) dockerd

c) docker toolbox

d) docker-compose

 

43) A user reported that a service called “myweb” is not working properly.

Your cluster is still using the default logging drivers. Which command

should you use to gather information for troubleshooting?

a) docker service logs myweb

b) docker logs myweb

c) cat /var/log/messages | grep myweb

d) cat /var/log/docker

 

44) Which of the following commands will allow you to display the token

and command needed to join the existing cluster as a worker?

a) docker swarm list-tokens

b) docker swarm join-token worker

c) docker swarm token --worker

d) None of the above.

 

45) Which of the following commands will display all of the base images

available on local docker storage?

a) docker list

b) docker view images

c) docker images

d) docker list image

 

46) In what format is the output printed to terminal when you run ‘docker

inspect [container name]’ command (by default)?

a) JSON

b) YAML

c) CSV

d) HTML

 

47) Which of the following statements is not true?

a) You can attach multiple volumes on a container

b) You can attach multiple networks on a container

c) You can attach a volume to multiple containers

d) You can install multiple version of dockers in one host

 

48) Which command can be used to remove an image even if that image

has containers that are based on it?

a) docker image remove --all

b) docker rm [image name] --force

c) docker rmi [image name] --force

d) docker remove [image name]

 

49) Which option, when provided to a container at startup, will

automatically clean up the container and remove the file system when the

container exits?

a) --clean-up

b) --rm

c) --exit

d) --delete-on-exit

 

50) Which restart policies will make the Docker daemon try to restart the

container indefinitely and also always start on daemon startup, regardless of

the current state of the container?

a) on-failure

b) unless-stopped

c) always

d) no

 

 

 

 

Practice Exam 4 Answer Key

1) a

2) d

3) c

4) a

5) d

6) a

7) d

8) b

9) a

10) c

11) b

12) c

13) d

14) b

15) c

16) c

17) a

18) b

19) c

20) a

21) d

22) b

23) a

24) c

25) a

26) c

27) a, b, d

28) a, b, c

29) c

30) a

31) b

32) d

33) c

34) a, b, c

35) a

36) c

37) a

38) b

39) d

40) c

41) b

42) d

43) a

44) c

45) c

46) a

47) d

48) c

49) b

50) c