Docker Exam Questions and Answers
Docker Exam Questions and Answers What do you use to gracefully remove a node from a swarm cluster? - Answer️️ - Docker swarm leave (on the node to remove). What is the command used to initialize 'swarm mode' ? - Answer️️ -docker swarm init How do you push the new image called 'httpd:new' to the default repository? - Answer️️ -Docker push httpd:new (prompt for username/password). What is the command to initialize a single replica? - Answer️️ -docker service create [image] How do you create a Docker image from a Dockerfile in the current directory, naming the image 'myimage:v1'? - Answer️️ -docker build -t myimage:v1 . What is the `docker swarm unlock-key --rotate` command for? - Answer️️ -It performs a key rotation for security on a regular basis. What is the command to remove a service from your swarm cluster? - Answer️️ - docker service rm [SERVICE NAME] `docker volume ls` - Answer️️ -- Lists created volumes. - Will propagate on service creation. The directive in a Dockerfile that instantiated containers will listen on the indicated port at launch. - Answer️️ -EXPOSE `docker network create` - Answer️️ ---driver=overlay --subnet=[network/mask] --gateway=[IP] --ip-range=[subnet/mask] - only good to further divide network from subnet definition How do you display a list of all running containers on the system? - Answer️️ -docker ps How do you create a new /bin/bash process inside a running container called 'myweb' on the current terminal? - Answer️️ -docker exec -it myweb /bin/bash What is the command to join an existing swarm as a 'worker' node? - Answer️️ -docker swarm join --token [token] [IP]:2377 How do you display all Docker containers (running or stopped), but list ONLY the Container IDs and not the associated names? - Answer️️ -docker ps -a -q What demotes a 'master' or 'manager' node to a 'follower' node? - Answer️️ -docker node demote [NODE ID] What is the directive within a Dockerfile that creates a mount point inside instantiated containers that can be used to mount external volumes? - Answer️️ -VOLUME What will drain a cluster node to prevent services from running on it in the future (as a precursor to removing it)? - Answer️️ -docker node update --availability drain [NODE ID] (from the manager) What is the command to create a new Docker network for containers to use called 'mynet'? - Answer️️ -docker network create --subnet [RANGE] mynet What is the command to allow you to log in with the specified username to a remote image repository? - Answer️️ -docker login --username=[USERNAME] What is the directive in a Dockerfile that sets the author of the generated image? - Answer️️ -MAINTAINER What returns the status of a Docker Swarm cluster (from the manager node)? - Answer️️ -docker node ls How do you instantiate a container called 'myweb', running non-interactively, from an image called 'httpd:latest'? - Answer️️ -docker run -d --name myweb httpd:latest What command lists all available Docker networks in your syste
Written for
- Institution
- DCA
- Course
- DCA
Document information
- Uploaded on
- May 23, 2024
- Number of pages
- 14
- Written in
- 2023/2024
- Type
- Exam (elaborations)
- Contains
- Questions & answers
Subjects
-
docker exam questions and answers
Also available in package deal