Practice Questions for Docker Certified Associate (DCA) Exam 🐳 — Set 1
Docker is quite the buzz tool nowadays, it is a tool that is making it easier to create, deploy, and run applications by using containers.
In today’s job market having Docker skills proves to be of immense importance and the Docker Certified Associate (DCA) exam is designed to validate that skillset with real-world questions designed by experienced Docker practitioners.
I believe you have stumbled on this post cause you have already begun your journey in becoming a Docker Certified Associate. To aid you in the process, I have compiled a few sample questions and answers below. This will definitely give you an idea of what format and kind of questions to expect during your examinations. Without further a-do, get cracking 😉
What is the command to set DNS server for all Docker containers?
Options are :
dockerd --dns-update IP_ADDRESS
dockerd --set-dns IP_ADDRESS
dockerd --dns-server IP_ADDRESS
dockerd --dns IP_ADDRESS
Answer : dockerd --dns IP_ADDRESS
What is the correct order to backup Docker EE components?
Options are :
- Backup DTR, UCP, and then Swarm
- Backup Swarm, DTR, and then UCP
- Backup Swarm, UCP, and then DTR
- Backup UCP, Swarm, and then DTR
Answer: Backup Swarm, UCP, and then DTR
What is the docker command to backup the UCP?
Options are :
docker ucp backup
docker backup ucp
docker backup all
docker/ucp backup
Answer : docker/ucp backup
What is the docker command to add or update a published port?
Options are :
docker service update --publish-add
docker service update --publish-port
docker service set --add-port
docker service modify --add-update-port
Answer : docker service update --publish-add
What is the difference between UCP workers and managers?
Options are :
- Ucp-agent service automatically starts serving UCP components and proxy service only on worker node.
- Ucp-agent service automatically starts serving UCP components and proxy service only on manger node.
- Ucp-agent service automatically starts serving all UCP components in manager node and only proxy service in worker node.
- Ucp-agent service automatically starts serving UCP components in worker node, and only a proxy service in manager node.
Answer: Ucp-agent service automatically starts serving all UCP components in manager node and only proxy service in worker node.
Which of the below correct command that needs to be executed to sign an image before pushing it to the repository?
Options are :
export TRUST_DOCKER_IMAGE=1
export TRUST_DOCKER_CONTENT=1
export SIGN_DOCKER_IMAGE=1
export DOCKER_CONTENT_TRUST=1
Answer : export DOCKER_CONTENT_TRUST=1
Which of the below Dockerfile directive would set up the base image that can serve as our starting point for establishing a new image?
Options are :
FROM
BASE
ARG
START
Answer : FROM
Which of the following best describes the procedure for backing up the Universal Control Plane (UCP) metadata?
Options are :
- Create an archive for all of the data under the
/etc/docker/ucp
directory. - Create an archive for all of the data under the
/var/data/ucp
directory. - Run a container from the ucp image with the backup command.
- Run a container from the ucp image with the
uninstall-ucp
command.
Answer: Run a container from the ucp image with the backup command.
What is the docker command to setup a swarm?
Options are :
docker create swarm
docker init swarm
docker swarm init
docker swarm create
Answer : docker swarm init
What does the FROM directive do?
Options are :
- It indicates the build location of where the image is.
- It pulls a file from an external source into the image.
- It sets a base image that can be used as a platform to begin builds.
- It sets the working directory of containers ran using the image.
Answer: It sets a base image that can be used as a platform to begin builds.
Which of the following commands is correct if the container exits due to an error, which manifests as a non-zero exit code.
Options are :
docker run --restart unless-stopped nginx
docker run --restart no nginx
docker run --restart on-failure nginx
docker run --restart failure-only nginx
Answer : docker run --restart on-failure nginx
Which Docker edition would you choose for obtaining the latest Docker Engine updates?
Options are :
- Docker Enterprise Edition (EE)
- Docker Developer Edition (DE)
- Docker Community Edition (CE)
- Either Docker CE or Docker EE
Answer : Either Docker CE or Docker EE
- Which of the following is not backed up when performing a Docker Trusted Registry (DTR) metadata backup?
Options are :
- DTR Configurations
- Repository metadata.
- Docker images.
- Role-based access control (RBAC) settings.
Answer : Docker images.
What is the endpoint that we can use to check the health of a single UCP manager node?
Options are :
https:///\_ heartbeat
https:///\_ping
https:///\_ health
https:/// \_status
Answer : https:///\_ping
What is the docker command to roll back to the previous version of a service?
Options are :
docker service --rollback
docker service --rollback-version
docker service update --rollback
docker service update --rollback-version
Answer : docker service update --rollback
What are the two types of UCP client bundles?
Options are :
- Admin user certificate bundles and user certificate bundles.
- Docker CLI bundles and Docker web Ui bundles.
- Docker UCP Client bundles and DTR client bundles.
- Ops client bundles and dev client bundles.
Answer: Admin user certificate bundles and user certificate bundles.
What is the docker command to display detailed information on one or more networks?
Options are :
docker inspect network
docker network display
docker network inspect
docker network status
Answer : docker network inspect
What is the docker command to create a container with custom DNS server(s)?
Options are :
docker container create --cusom-dns=IP_ADDRESS
docker container create --set-dns=IP_ADDRESS
docker container create --dns=IP_ADDRESS
docker container create --add-dns=IP_ADDRESS
Answer : docker container create --dns=IP_ADDRESS
Which of the following commands will ensure that a container uses a maximum of 1 GB of active memory?
Options are :
docker run --memory-swap 2G nginx
docker run --memory 1G nginx
docker run --memory-swap 2G --memory-reservation 1G
docker run --memory-reservation 1G nginx
Answer : docker run --memory 1G nginx
Niels has an application that consists of multiple different containers that interact with one another. What should he use to manage this application in a Docker Swarm?
Options are :
- Niels should use a service with multiple tasks.
- Niels should use docker-compose .
- Niels should use a stack .
- Niels should use a task .
Answer: Niels should use a stack .
Danny wants to prevent Docker Swarm encryption keys from being stored insecurely on her swarm managers. How can he tackle enforcing a lock on the swarm cluster?
Options are :
- Danny can locate the critical files after the installation and delete them.
- Danny cannot do this because Docker does not offer this functionality.
- The autolock feature must be turned on when the cluster is initialized and cannot be enabled after the fact.
- Danny can use the
--autolock=true
flag with the docker swarm update command.
Answer: Danny can use the --autolock=true
flag with the docker swarm update command.
Where can you get a repository URL for installing the Docker Enterprise Edition (EE)?
Options are :
- Docker Hub
- Docker Enterprise Hub
- Docker Trusted Registry
- Docker Marketplace
Answer: Docker Hub
What are the requirements to install Docker Trusted Registry (DTR)? (Select all that apply)
Options are :
- Make sure the port 8080 and 8443 are open on the node
- All nodes must be a worker node managed by Universal Control Plan
- DTR can be installed on-premises or on a cloud provider
- All nodes must have fixed hostname
Answer: All nodes must be a worker node managed by Universal Control Plan DTR can beinstalled on-premises or on a cloud provider All nodes must have fixed hostname
Which of the following is true about building docker images?
Options are :
- Every Dockerfile can have only one FROM directive.
- Only layers that have changed since the last build (and any following layers) are built.
- Every layer of the image is re-built every time docker build is executed.
- Every Dockerfile can have only one FROM directive.
Answer: Only layers that have changed since the last build (and any following layers) are built.
What would be the runtime working directory of a container built from the following Dockerfile?
FROM alpine
WORKDIR /a
WORKDIR /b
WORKDIR c
CMD pwd
Options are :
/c
/a
/b/c
/
Answer : /b/c
Which of the following tool to use to create users and teams?
Options are :
- Universal Control Plane
- Docker Machine
- Docker compose
- Docker Trusted Registry
Answer: Universal Control Plane
Where is the option to integrate Docker Enterprise with LDAP?
Options are :
- Docker Trusted Registry
- Docker Compose
- Docker Machine
- Universal Control Plane
Answer: Universal Control Plane
What is the docker command to find the current logging driver for a running container?
Options are :
docker info
docker config
docker inspect
docker status
Answer : docker inspect
Describe what the RUN directive does.
Options are :
- The
RUN
directive sets the default command for the image. - The
RUN
directive executes a command on the host when building an image. - The
RUN
directive executes a command and commits the resulting changed files as a new layer in the image. - The
RUN
directive automatically runs a command when a new container gets created.
Answer: The RUN
directive executes a command and commits the resulting changed files asa new layer in the image.
Paul have some containerized software that needs to have a reference to the hostname of the node that the software is running on. Which of the following commands Paul will pass the node hostname as an environment variable into each task in a service?
Options are :
docker service create --env NODE_HOSTNAME="{{.Node.Hostname}}" nginx
docker service create -e NODE_HOSTNAME nginx
docker service create --env NODE_HOSTNAME="{{Hostname}}" nginx
docker service create --pass-node-hostname=true nginx
Answer : docker service create --env NODE_HOSTNAME="{{.Node.Hostname}}" nginx
Which of the below statements does not apply to the WORKDIR directive?
Options are :
- It affects only the build and does not impact containers that run from the image.
- It affects only the build and does not impact containers that run from the image.
- It can use both absolute and relative paths.
- It affects only the build and does not impact containers that run from the image.
Answer: It affects only the build and does not impact containers that run from the image.
Which of the following scenarios would still allow the quorum to have maintenance in a swarm cluster? (Choose two)
Options are :
- A 3-node cluster with 1 node down.
- A 3-node cluster with 2 nodes down
- A 7-node cluster with 3 nodes down.
- A 4-node cluster with 2 nodes down.
Answer: A 3-node cluster with 1 node down. A 7-node cluster with 3 nodes down.
Which of the following commands can we use to view detailed metadata about a container? (select two)
Options are :
docker metadata
docker inspect
docker container inspect
docker query
Answer : docker inspect docker container inspect
What does the EXPOSE directive do?
Options are :
- It causes the container to listen on a port.
- It documents ports intended for publishing at the time of running a container.
- It automatically publishes ports when running a container.
- It makes a container’s port accessible externally.
Answer: It documents ports intended for publishing at the time of running a container.
Which of the following statements truly applies to the ENV directive?
Options are :
- It sets an environment variable on the host while the container is running
- It sets environment variables that are only visible at the container runtime.
- It sets environment variables that are made available in subsequent build steps and to containers at the runtime.
- It sets environment variables that are only visible during later build steps
Answer: It sets environment variables that are made available in subsequent build steps and to containers at the runtime.
In Docker security, scan result is available in both UCP and DTR.?
Options are :
- TRUE
- FALSE
Answer: FALSE
What is the docker command to increase the number of replicas?
Options are :
docker service replica
docker service increase
docker service scale
docker service build
Answer : docker service scale
How to configure the default logging driver?
Options are :
- Use
--log-driver
flag - Set the
--log-driver
option in the deamon.json file - Set the
--log-driver
option in the key.json file - Use
--loging-driver --flag
Answer: Set the --log-driver
option in the deamon.json file
What are the steps to perform to sign images in a way that UCP trusts them? (select all that apply)
Options are :
- Delegate signing to the keys in your UCP client bundle
- Initialize trust metadata for the repository
- Approve image sign on UCP
- Configure Notary client
Answer: Delegate signing to the keys in your UCP client bundle Initialize trust metadata for the repository Configure Notary client
What is the docker command to backup the UCP?
Options are :
docker backup ucp
docker/ucp backup
Answer : docker/ucp backup
What are the requirements to install Docker Trusted Registry (DTR)? (Select all that apply)
Options are :
- Make sure the port 8080 and 8443 are open on the node
- All nodes must have a fixed hostname
- DTR can be installed on-premises or on a cloud provider
- All nodes must be a worker node managed by Universal Control Pla
Answer: All nodes must have a fixed hostname DTR can be installed on-premises or on a cloud provider All nodes must be a worker node managed by UCP
What is the docker command to setup a swarm?
Options are :
docker init swarm
docker create swarm
docker swarm create
docker swarm init
Answer : docker swarm init
What is the recommended approach to set storage driver?
Options are :
- Set the “storage-driver” option in the daemon.json file
- Use
--storage-driver
flag when running dockerd
Answer: Set the “storage-driver” option in the daemon.json file
What is the docker command to add a node to a swarm?
Options are :
docker swarm join
docker swarm create-node
docker join swarm
docker swarm add-node
Answer : docker swarm join
What is the correct order to upgrade a Docker cluster?
Options are :
- Upgrade DTR, UCP, then engine and kernel
- Upgrade engine and kernel, DTR, and then UCP
- Upgrade engine and kernel, UCP, and then DTR
- Upgrade UCP, DTR, then engine and kernel
Answer : Upgrade engine and kernel, UCP, and then DTR
What is the function of docker inspect command?
Options are :
- To return low-level information on Docker objects
- To display system-wide information
- To manage Docker configs
- To inspect changes to files or directories on a container’s filesystem
Answer: To return low-level information on Docker objects
What is the default format of docker inspect output?
Options are :
- yaml
- html
- xml
- json
Answer: json
What are the two types of docker swarm services?
Options are :
- distributed and replicated services
- replicated and local services
- local and global services
- replicated and global services
Answer: replicated and global services
What is the difference between a replicated and a global service?
Options are :
- Number of identical tasks can be specified for a replicated service. There is no pre-specified number of tasks for global service
- Replicated service can only be deployed on manager node. Global service can be deployed on both manager and worker node
- Replicated service runs one task on every node. Global service runs multiple task on every node
- Good candidates for replicated service are monitoring agents that you want to run on every node in the swarm. Good candidates for global service are http servers.
Answer: Number of identical tasks can be specified for a replicated service. There is no pre-specified number of tasks for global service
What is the docker command to add a network to a service?
Options are :
docker service modify --add-network
docker service update --network-add
docker service set --add-network
docker service add-network
Answer : docker service update --network-add
How is the ADD
directive different from COPY ? (Choose two)
Options are :
- The
ADD
directive can transfer a specific file between build stages. - The
ADD
directive can pull a file from an external URL. - The
ADD
directive can extract an archive into the image. - The
ADD
directive can transfer files over to a specific location inside the image.
Answer: The ADD
directive can pull a file from an external URL. The ADD directive canextract an archive into the image.
What command would we use to locate the layered file system data for an image on a machine?
Options are :
docker image inspect
docker layer inspect
docker pull history
docker image layers
Answer : docker image inspect
Which of the following namespaces is not enabled by default?
Options are :
pid
uts
user
mnt
Answer : user
Which of the following docker command can be used to find out all the ports mapped? (select all that apply).
Options are :
docker inspect
docker network ls
docker ps
docker port
Answer : docker inspect docker ps docker port
You can monitor the status of UCP by using the web UI or the CLI?
Options are :
- FALSE
- TRUE
Answer : TRUE
Stay tuned to get further sets… 😉