Docker Certified Associate (DCA) Practice Test Set 1

You created a docker swarm cluster using "docker swarm init" command. After creating the swarm cluster you got a command using which you could add a worker to your cluster. But you have lost that command and now you want to add new workers to your cluster. How would you do that?


Options are :

  • docker swarm init-token worker
  • docker swarm init-token manager
  • docker swarm join-token manager
  • docker swarm join-token worker (Correct)

Answer :docker swarm join-token worker

Docker Certified Associate 2020 - Practice Exams - NEW Set 5

Which of the following statement below is NOT TRUE about docker-compose?


Options are :

  • docker-compose is well suited for development environments
  • docker-compose can not be used to create new container images
  • docker-compose will bring up services as specified in docker-compose.yml
  • docker-compose can be used with docker swarm to run services across different workers. (Correct)

Answer :docker-compose can be used with docker swarm to run services across different workers.

Which of the following version of "docker-compose.yml" files can you use with "docker stack" command?


Options are :

  • version 1 and above
  • version 2 and above
  • version 3 and above (Correct)
  • Any version

Answer :version 3 and above

Which of the following statements is NOT TRUE about replicated service in docker?


Options are :

  • A service running in a replicated mode may not run in all nodes.
  • For replicated services, the scheduler places one task on each available node that meets the serviceís placement constraints and resource requirements. (Correct)
  • If you donít specify a mode, the service defaults to replicated
  • For replicated services you can specify number of replica tasks

Answer :For replicated services, the scheduler places one task on each available node that meets the serviceís placement constraints and resource requirements.

Docker and Containers: Commands Set 1

A global service is a service that runs ____ task/tasks on every node that meet the placement and resource constraints


Options are :

  • many
  • one (Correct)
  • more than one
  • none

Answer :one

Which one is a valid command to run a global service in docker swarm?


Options are :

  • docker service create --mode global (Correct)
  • docker swarm create --mode global
  • docker service create --global
  • docker swarm create --global

Answer :docker service create --mode global

You are running a service called 'webserver'. You need to increase the number of replicas of that service to 5. Which of the following commands would achieve this?


Options are :

  • docker swarm scale webserver=5
  • docker service scale webserver=5 (Correct)
  • docker service --replicas=5 webserver
  • docker swarm --replicas=5 webserver

Answer :docker service scale webserver=5

Docker Certified Associate (DCA) Practice Exams Set 24

Your company needs to run a custom monitoring application published in Docker Hub called "examplecorp/stats-collector". You must ensure this would run in all swarm nodes, regardless how many nodes you currently have or if a new one would join the swarm eventually. This monitoring system requires an environment variable called ENDPOINT_ADDRESS that sends the metrics to an external service hosted at 'service.example.com'. Which of the following commands would accomplish these requirements?


Options are :

  • docker service create --name stats-collector --replicas=1 --entrypoint ADDRESS="service.example.com" examplecorp/stats-collector
  • docker service create --name stats-collector --replicas=auto --entrypoint ADDRESS="service.example.com" examplecorp/stats-collector
  • docker service create --name stats-collector --mode=global -e ENDPOINT_ADDRESS="service.example.com" examplecorp/stats-collector (Correct)
  • docker service create --name stats-collector --mode=replicated -e ENDPOINT_ADDRESS="service.example.com" examplecorp/stats-collector

Answer :docker service create --name stats-collector --mode=global -e ENDPOINT_ADDRESS="service.example.com" examplecorp/stats-collector

Which of the following is NOT TRUE about running a stack of services?


Options are :

  • The docker-compose.yaml file can be used both on docker stack and docker-compose.
  • The docker-compose.yaml file must be version 3.0 or higher in order to use it in a stack.
  • Docker stack can run without docker swarm (Correct)
  • A stack would run across all nodes on a Swarm, while running on docker-compose would run in a single node, even if it is a swarm node.

Answer :Docker stack can run without docker swarm

You are running UCP service on a swarm with 3 managers and 2 workers. You need to schedule a backup policy for your UCP service. How many nodes you need to fully back up this service?


Options are :

  • 2
  • 1 (Correct)
  • 3
  • 5

Answer :1

Docker Certified Associate (DCA) Practice Exams Set 21

Which of the following statements is NOT TRUE regarding to running a container vs running a service?


Options are :

  • You can run multiple copies of a container image in both cases.
  • You can achieve fault-tolerance running mutiple copies of a container image without the need to run them as a service. (Correct)
  • Running your container image as a service eliminates the needs of setting up a load balancer.
  • Docker Secrets is available while running your container image as a service.

Answer :You can achieve fault-tolerance running mutiple copies of a container image without the need to run them as a service.

Which of the following is NOT true regarding docker swarm mode?


Options are :

  • You can deploy both kinds of nodes, managers and workers, using the Docker Engine
  • For each service, you can declare the number of tasks you want to run. When you scale up or down, the swarm manager automatically adapts by adding or removing tasks to maintain the desired state.
  • The swarm manager automatically assigns addresses to the containers on the overlay network when it initializes or updates the application.
  • Docker swarm mode is a plugin which you can install alongside docker to run a cluster of docker engines (Correct)

Answer :Docker swarm mode is a plugin which you can install alongside docker to run a cluster of docker engines

What is docker command to create swarm?


Options are :

  • docker swarm initialize
  • docker swarm start
  • docker swarm join
  • docker swarm init (Correct)

Answer :docker swarm init

Docker Certified Associate (DCA) Practice Exams Set 18

Given the following Dockerfile below: FROM ubuntu ENTRYPOINT ["exec_entry", "p1_entry"] CMD exec-cmd p1_cmd What is the command that gets executed when someone runs the image built using this Dockerfile?


Options are :

  • exec_entry p1_entry /bin/sh -c " exec-cmd p1_cmd " (Correct)
  • exec_entry p1_entry exec_cmd p1_cmd
  • exec_entry p1_entry
  • /bin/sh -c " exec-cmd p1_cmd "
  • /bin/sh -c "exec_entry p1_entry" /bin/sh -c " exec-cmd p1_cmd "

Answer :exec_entry p1_entry /bin/sh -c " exec-cmd p1_cmd "

Which of the following is NOT true about dockerignore?


Options are :

  • .dockerignore file can be used to exclude files and directories from docker context
  • .dockerignore must be present in the root directory of the context
  • .dockerignore can help in bringing down image size and speed up builds
  • .dockerignore is available only with docker enterprise edition (Correct)

Answer :.dockerignore is available only with docker enterprise edition

Which of the following patterns would exclude all Python byte-code files from being copied during the Docker image creation process?


Options are :

  • **.pyc
  • **/*.pyc (Correct)
  • *.pyc
  • /*.pyc

Answer :**/*.pyc

Docker Certified Associate (DCA) Practice Exams Set 26

Which of the following flags can be used with "docker build" command so that it never uses cached layer during the build steps.


Options are :

  • -f
  • --rm
  • --no-cache (Correct)
  • --compress

Answer :--no-cache

Which of the following is a valid flag to not use cache while doing a docker build?


Options are :

  • --no-cache (Correct)
  • --cache=false
  • --no-cache=true (Correct)
  • You cannot disable caching with docker build

Answer :--no-cache --no-cache=true

You have the following values in your Dockerfile ENV abc=hello ENV abc=bye def=$abc ENV ghi=$abc What is the correct output of command "echo $abc $def $ghi" run inside the container?


Options are :

  • hello bye hello
  • bye bye hello
  • bye hello bye (Correct)
  • hello hello bye

Answer :bye hello bye

Docker Certified Associate (DCA) Practice Exams Set 20

Which of the following is true about Entrypoint of an Image.


Options are :

  • Itís the script that anyone using the image must execute to initialize things inside container
  • Itís a command that will be executed anytime a container is created using the image. (Correct)
  • It is defined while creating the image and cannot be overridden
  • Entrypoint must be a script

Answer :Itís a command that will be executed anytime a container is created using the image.

Given the following Dockerfile below: FROM alpine ENTRYPOINT ["exec_entry", "p1_entry"] CMD ["exec_cmd", "p1_cmd"] What is the command that gets executed when someone runs this image built using this Dockerfile?


Options are :

  • exec_entry p1_entry exec_cmd p1_cmd (Correct)
  • /bin/sh -c "exec_entry p1_entry"
  • exec_cmd p1_cmd
  • /bin/sh -c "exec_entry p1_entry exec_cmd p1_cmd"

Answer :exec_entry p1_entry exec_cmd p1_cmd

Which of the following statement is correct? Pick exactly two statements.


Options are :

  • Image is a collection of immutable layers whereas container is a running instance of an image. (Correct)
  • Container can exist without the image but image cannot exist without container
  • Only one container can be spawned from a given image at a time
  • If multiple containers are spawned from the same image then they all use the same copy of image in memory. (Correct)

Answer :Image is a collection of immutable layers whereas container is a running instance of an image. If multiple containers are spawned from the same image then they all use the same copy of image in memory.

Docker Certified Associate (DCA) Practice Exams Set 25

Which of the following commands can be used to check Entrypoint and CMD of a given docker image?


Options are :

  • docker image inspect (Correct)
  • docker image ls
  • docker info image
  • docker image info

Answer :docker image inspect

Which of the following commands can be used to delete an existing image?


Options are :

  • docker image delete
  • docker rmi (Correct)
  • docker rm
  • docker rm image

Answer :docker rmi

You are in a directory containing a file named Dockerfile-app. You want to build a docker image using this "Dockerfile-app" file without renaming it to "Dockerfile". Which of the following answers is correct?


Options are :

  • docker build -d Dockerfile-app
  • docker build -f Dockerfile-app (Correct)
  • docker build --dockerfile Dockerfile-app
  • docker build --from-file Dockerfile-app

Answer :docker build -f Dockerfile-app

Docker Certified Associate (DCA) Practice Tests Set 3

One fine morning while configuring docker host bob got stuck with a problem. Docker service just wouldnít start. After checking logs Bob found the following error. When would an error like this arise? unable to configure the Docker daemon with file /etc/docker/daemon.json: the following directives are specified both as a flag and in the configuration file: hosts: (from flag: [unix:///var/run/docker.sock], from file: [tcp://127.0.0.1:23]


Options are :

  • After configuring the same flag in both daemon.json and dockerd flags (Correct)
  • After upgrading docker
  • After running docker without systemd
  • After killing dockerd process and restarting it manually

Answer :After configuring the same flag in both daemon.json and dockerd flags

Bob has configured his docker daemon to use syslog log driver by default, how can he run a container which uses json-file log driver?


Options are :

  • By using "--log-opt json-file" along with docker run
  • By using "--log-driver json-file" along with docker run (Correct)
  • By using "--logger json-file" along with docker run
  • Not possible

Answer :By using "--log-driver json-file" along with docker run

Bob did a fresh installation of docker on his new linux server. He hasnít tinkered with anything and has just installed docker packages from official repository. He runs a new container with command "docker run -d nginx" , which logging driver will this container use?


Options are :

  • syslog
  • logentries
  • json-file (Correct)
  • journald

Answer :json-file

Docker and Containers: Commands Set 3

Bob wants to debug some issues happening with his docker daemon running on a linux system, he made some changes to his docker daemon using daemon.json file, now he wants docker to reload those changes but he canít restart docker because he has something critical running on it, which of the following might help him achieve that?


Options are :

  • sudo kill -9 $(pid of dockerd)
  • sudo kill -1 $(pid of dockerd)
  • sudo systemctl restart $(pid of dockerd)
  • sudo kill -SIGHUP $(pidof dockerd) (Correct)

Answer :sudo kill -SIGHUP $(pidof dockerd)

The feature of limiting memory while running a container is provided by which of the following?


Options are :

  • cgroups (Correct)
  • namespaces
  • systemd
  • selinux

Answer :cgroups

Bob has username "bob" on his linux system. He did a fresh installation of Docker and he doesn't want to preface docker commands with sudo. To which linux user group should he add himself to achieve that?


Options are :

  • root
  • docker (Correct)
  • admins
  • owner

Answer :docker

Docker Certified Associate (DCA) Practice Exams Set 17

What is docker command to see container logs?


Options are :

  • docker dump-logs
  • docker logs (Correct)
  • docker get-logs
  • docker fetch-logs

Answer :docker logs

Which of the following gives a web dashboard to manage docker cluster?


Options are :

  • Docker swarm mode
  • Docker UCP (Correct)
  • Docker-compose
  • DTR

Answer :Docker UCP

Fill in the blank: On Linux, Docker manipulates _______ rules to provide network isolation.


Options are :

  • iptables (Correct)
  • bpfilter
  • nftables
  • ufw
  • conntrack

Answer :iptables

Docker Certified Associate (DCA) Practice Exams Set 20

Network isolation by docker is provided by which one of the following linux kernel features?


Options are :

  • cgroups
  • namespace (Correct)
  • ulimits
  • file descriptors

Answer :namespace

Comment / Suggestion Section
Point our Mistakes and Post Your Suggestions