Docker Practice Exams 1
Posted by Superadmin on July 12 2018 09:13:58

Docker Practice Exam 1

 

1) Which command will allow you to execute and commit the results of any

command in a new layer on top of the current image?

a) FROM

b) RUN

c) CMD

d) INIT

 

 

2) What does the EXPOSE command do?

a) Inform docker to listen to all ports

b) Informs Docker which directory container will expose to public on at

runtime

c) Informs Docker which network ports the container will listen on at

runtime

d) None of the above.

 

 

3) Which default directory will Docker store its image layers?

a) /run/layers/docker

b) /etc/docker/storage

c) /tmp/docker/layers

d) /var/lib/docker/<storage-driver>/layers

 

 

4) What is the minimum number of managers nodes required for an HA

setup?

a) 1 node

b) 2 nodes

c) 3 nodes

d) 4 nodes

 

 

5) Which command will allow the user “john” to run Docker commands,

without needing elevated privileges?

a) usermod -aG docker john

b) service start docker --enabled

c) chown -R john:john /var/lib/docker

d) None of the above.

 

6) Which command will allow the user to monitor the state of the Docker

daemon service?

a) cat /var/run/docker/info

b) service docker status=info

c) docker get status

d) systemctl status docker

 

7) Which Docker network interface will be used by default when you run a

new container using “docker run” command?

a) docker0

b) bridge0

c) overlay0

d) eth0

 

8) Which of the following commands will automatically start the docker

service on boot?

a) systemctl enable docker

b) system start docker --on-boot=true

c) service docker-ce on-boot=true

d) docker-ce --enable-on-boot

 

9) Which file contains information of of the PID (Process ID) of the Docker

service when it is running?

 

a) /run/docker.pid

b) /run/docker.sock

c) /var/lib/docker/docker.pid

d) None of the above

 

10) Which Unix socket file does Docker use to determine which accounts

can use the service?

a) /opt/run/docker.sock

b) /tmp/run/docker.sock

c) /run/docker.sock

d) /run/docker/daemon.sock

 

11) Which file can be configured to modify the default Docker storage

driver?

a) /var/lib/docker/devicemapper.conf

b) /var/lib/docker/storage.conf

c) /etc/docker/daemon.json

d) /var/lib/docker/volumes/driver.json

 

12) Which file can be configured to modify the default Docker logging

driver?

a) /etc/docker/daemon.json

b) /var/lib/docker/logging.conf

c) /etc/docker/log.json

d) /var/log/docker/daemon.conf

 

13) Which command will build a Docker image named “myapps:latest”

using the Docker File available in the current directory?

a) docker build . --name=myapps:latest

b) docker build myapps:latest -t .

c) docker build -t myapps:latest .

d) None of the above.

 

14) What command can be used to login to the Docker repository “dockerregistry.example.com”

using user “john” ?

a) docker login --username=john --server-url docker-registry.example.com

b) docker login --username=john docker-registry.example.com

c) docker login -u john -h docker-registry.example.com

d) None of the Above

 

15) Which of the following commands will allow you to run an interactive

shell on a running container?

a) docker run -it [containername] /bin/bash

b) docker ssh [containername]

c) docker exec -d [containername] --interactive /bin/bash

d) docker exec -it [containername] /bin/bash

 

16) Which of the following commands will allow a user to view all member

nodes of Docker swarm clusters when run on one of the manager nodes?

a) docker node ls

b) docker node --show-members

c) docker swarm node show

d) None of the Above

 

17) Which command can be used to display logs of a service in Docker

swarm?

a) docker logs --service=[SERVICE NAME]

b) docker service cat --logs [SERVICE NAME]

c) docker service logs [SERVICE NAME]

d) None of the above.

 

18) Which of the following commands will allow you to scale the service

called ‘frontend’ to FIVE replicas?

a) docker service scale frontend=5

b) docker service scale --replicas=5 frontend

c) docker run frontend --scale=5

d) docker scale swarm --nodes=5

 

19) Create a service called ‘webapp’ that contains three replicas based on

image called “tomcat-custom”.

a) docker service create --name tomcat-custom --replicas 3 webapp

b) docker service create --name=webapp --number=3 tomcat-custom

c) docker service start name=webapp replicas=3 tomcat-custom

d) docker service create --name webapp --replicas 3 tomcat-custom

 

20) Which of the following will list all the service processes currently

running in a swarm cluster?

a) docker service ps

b) docker swarm service --list

c) docker ps -a

d) docker swarm --service-list

 

21) Which of the following commands will allow you to get token needed

for a ‘manager’ node to join an existing cluster?

a) docker swarm get-token manager

b) docker swarm join-token manager

c) docker swarm token-retrieval --manager

d) None of the above.

 

22) Which command allows you to leave a swarm when executed from the

intended node?

a) docker swarm leave

b) docker swarm rm node

c) docker swarm unregister

d) All of the above.

 

23) Which of the following commands will allow you to scale the number

of replicas in your swarm to SIX?

a) docker service scale [SERVICE NAME]=6

b) docker service replicas=6

c) docker scale swarm --nodes=6

d) docker swarm nodes=6

 

24) Which of the following commands would remove a service called

‘myapps’ on your cluster?

a) docker rm --service myapps

b) docker service rm myapps

c) docker rm myapps

d) None of the above.

 

25) Which of the following commands would temporarily stop a service

called ‘myweb’ on your cluster without actually removing it?

a) docker service scale myweb=0

b) docker service stop myweb

c) docker service rm myweb

d) docker rm myweb

 

26) Which command will create a swarm service called ‘my_api’ based on

an image called ‘httpd’?

a) docker service create --name httpd my_api

b) docker run --name my_api httpd

c) docker service create --name my_api httpd

d) None of the above.

 

27) Which command will remove a service called ‘my_apps’ from the

running swarm?

a) docker service stop my_apps

b) docker swarm remove my_apps

c) docker service rm my_apps

d) docker rm my_apps

 

28) Which of the following are the correct forms to use the CMD

instruction on Docker File (Choose three)?

a) CMD [“executable”,”param1”,”param2”]

b) CMD param1, CMD param2

c) CMD [“param1”,”param2”] (as default parameters to ENTRYPOINT)

d) CMD command param1 param2

 

29) Which command will drain a specified node to prevent future services

to run on it?

a) docker node update --availability drain [NODE ID]

b) docker node drain=[NODE ID]

c) docker node --availability=down --node=[NODE ID]

d) None of the Above

 

30) What does DTR stand for in Docker EE?

a) Docker Team Repository

b) Docker Trusted Repository

c) Docker Team Registry

d) Docker Trusted Registry

 

31) Given a token called ‘kdhgdlgjdighhsdfdf637’ and a manager listen on

10.0.1.100:2237, which of the following commands would allow a node to

join a swarm cluster?

a) docker swarm join --token kdhgdlgjdighhsdfdf637 10.0.1.100:2377

b) docker node join swarm ip 10.0.1.100 --token kdhgdlgjdighhsdfdf637

c) docker swarm --token=kdhgdlgjdighhsdfdf637 --ip=10.0.1.100

d) docker join swarm token kdhgdlgjdighhsdfdf637 --manager=10.0.100

 

32) Which command can be used to pull a “nginx” with tag “latest” image

from a default public repository?

a) docker pull nginx:latest

b) docker push nginx:latest

c) docker download nginx:latest

d) docker get nginx:latest

 

33) Which of the following resources would be removed by the “docker

system prune -a” command?

a) All stopped containers

b) All networks not used by at least one container

c) All volumes not used by at least one container

d) All of the above.

 

34) What is the name of the docker swarm features that enable each node in

the swarm to accept connections on published ports for any service running

in the swarm, even if there’s no task running on the node?

a) ingress-haproxy

b) routing mesh

c) shared-network

d) f5-loadbalancer

 

35) Which of the following commands will allow you to get the token

needed for a ‘worker’ node to join an existing cluster?

a) docker swarm get-tokens worker

b) docker swarm join-token worker

c) docker swarm token-retrieval --worker

d) All of the above.

 

36) Which command will restore the ‘drain’ task applied to a node so that it

can be scheduled again for services?

a) docker swarm --node=[NODE ID] --set-active

b) docker node update --availability active [NODE ID]

c) docker node undo [NODE ID]

d) docker node set-active [NODE ID]

 

37) Which of the following commands would clean up ALL container from

a Docker host?

a) docker image remove --all --force

b) docker rmi --all

c) docker system prune

d) docker rm -f `docker ps -a -q`

 

38) Which of the following parameters would you use to allow the

container to have access to the host filesystem when using the --mount

options?

a) type=host

b) bind=local

c) type=mount

d) type=bind

 

39) What is the content of a client bundle zip that was downloaded from

UCP (Choose all that apply)?

a) account security key

b) docker client binary

c) Environment variables files to set the connection destination.

d) UCP certificate files.

 

40) What does UCP stand for in the Docker EE?

a) Universal Control Plane

b) User Control Plane

c) Universal Control Panel

d) User Control Panel

 

41) When publishing a container service ports “80” using -P option, which

ports will Docker open on the hosts?

a) The same ports as the container if available, otherwise it will try to use

the closest port number

b) The same ports as the container if available, otherwise the operation fails

c) The -P option will not open any hosts port

d) Random port numbers above port 32768 on the host

 

42) Which of the following network drivers will remove network isolation

between the container and the Docker host and use the host’s networking

directly?

a) host

b) docker_gwbridge

c) overlay

d) None of the above.

 

43) Which of the following built-in networks will connect multiple Docker

daemons together and enable swarm services to communicate with each

other?

a) Default

b) Host

c) Overlay

d) Bridge

 

44) What command is used to stop a running container called “hello-world”

without deleting it? Choose all that apply.

a) docker stop hello-world

b) docker stop container hello-world

c) docker container stop hello-world

d) docker container pause hello-world

 

45) What does MTLS stand for?

a) Mini Transport Layer System

b) Mutual Transport Layer Security

c) Main Transport Secure Layer

d) None of the above.

 

46) What is the main language used in Docker?

a) Oracle

b) Java

c) Go

d) C#

 

47) Which environment variable must be set on the host to instruct docker

to ONLY download Docker trusted images?

a) DOCKER_CONTENT_TRUST=1

b) DOCKER_TRUSTED_CONTENT=1

c) DOCKER_SIGNED_IMAGE=1

d) DOCKER_IMAGE_TRUST=1

 

48) Which command will display ALL containers in a host , including the

stopped one?

a) docker psaux

b) docker run list container

c) docker container list all

d) docker ps -a

 

49) Which of the following commands will create a secret called

“mysecret” using a file named “encrypted_password.txt”?

a) docker register secret name=mysecret ./encrypted_password.txt

b) docker secret create mysecret ./encrypted_password.txt

c) docker create secret name=mysecret ./encrypted_password.txt

d) docker create secret name=mysecret --from-file=

./encrypted_password.txt

 

50) Which service does UCP 3.0 use for the application routing layer ?

a) haproxy

b) f5

c) cisco router

d) interlock

 

 

 

Practice Exam 1 Answer Key

1) b

2) c

3) d

4) c

5) b

6) d

7) a

8) a

9) a

10) c

11) c

12) a

13) c

14) b

15) d

16) a

17) c

18) a

19) d

20) a

21) b

22) a

23) a

24) b

25) c

26) c

27) c

28) a, c, d

29) a

30) d

31) a

32) c

33) d

34) b

35) b

36) b

37) d

38) d

39) a, c, d

40) d

41) d

42) a

43) c

44) a, c

45) b

46) c

47) a

48) d

49) b

50) d