Working with Containers: Docker & Docker Compose Educative Quiz Answers

Get Working with Containers: Docker & Docker Compose Educative Quiz Answers

Whether you are a DevOps beginner or just a developer who wants to start working with containers, you’re in the right place. Docker is an in-demand technology that you will be exposed to frequently while on the job.

Docker is used for setting up, deploying, and running applications, at scale, by containerizing them. More on that later. Docker also provides developers with a consistent environment for product development, and along with Kubernetes, makes managing the development lifecycle a breeze.

In this course, you will learn the fundamentals of Docker such as containers, images, and commands. You’ll then progress to more advanced concepts like connecting to a database container and how to simplify workflows with Docker Compose. At the end, you’ll learn how to monitor clusters and scale Docker services with Swarm.

Enroll on Educative

Quiz 1: Quiz on Dockerfile Automation

Q1. How do you map a host port to the container port?

  • docker run -i : imagename
  • docker run -p 5000:5000 flask_app:1.0
  • docker run –expose 5000:5000 flask_app:1.0
  • docker log <container_name>

Q2. Which keyword is used to set environment variables in Dockerfile?

  • SET
  • ENV

Q3. Select all the commands used to see logs of the container.

  • docker logs <container_name>
  • docker logs -v <container_name>
  • docker logs -f <container_name/ID>
  • docker log <container_name>

Q4. What is the use of lsof -i TCP:5000 command?

  • To list all the processes using port 5000.
  • To check how to use the port 5000.
  • This is incomplete command.

Q5. In docker build . command, what does . stands for?

  • It’s nothing but the full stop.
  • It represent the location of Dockefile, and . means current directory.
  • A hidden directory.

Quiz 2: Quiz on Advance Docker Concepts

Q1. Where is the list of the current reachable hosts/containers to a container located?

  • In docker inspect <network ID> command output
  • In /etc/hosts file.
  • In docker inspect <container-id> command output.

Q2. What is the drawback of default bridge network?

  • The automatic service discovery of containers using DNS is not supported.
  • Makes all containers accessible to each other.
  • Bridge network is limited to only 187 containers.

Q3. How to pass environment varibles while creating a container from prebuilt Image?

  • Create a Dockerfile and use ENV option.
  • Use -e option while creating a docker container.
  • Use --environ option.

Q4. What command is used to check details of a network?

  • docker network --info <network-id>
  • docker network ls
  • docker inspect <networkID>

Q5. What is the use of docker-compose?

  • To automate multi container environement using a docker-compose.yml file.
  • To estalish communication between all the project containers.
  • To provide easy and scalable deployments.

Quiz 4: Quiz on Docker Compose Concepts

Q1. Select all the options which can be used to provide environment variables to a container in docker-compose.yml file.

  • - env_file
  • - environment
  • - env
  • ENV

Q2. How to run docker-compose in detached mode or in the background?

  • Use --daemon flag with docker-compose up command.
  • Use -d option with docker-compose up command.
  • Use docker-compose run --background command.

Q3. Which commands can be used insted of docker-compose up?

  • docker-compose build and docker-compose start
  • docker-compose build and docker-compose run
  • docker-compose start and docker-compose run

Q4. How to specify location of Dockerfile in case of multiple Dockerfiles or to use Dockerfile located in different location?

  • Use context and dockerfile keywords under build section
  • Use dockerfile option and provide absolute path to the dockerfile.
  • Use directory option under build section with dockerfile.

Quiz 5: Quiz on Docker Swarm

Q1. Select all the options which applies to the Docker Swarm

  • A container orchestration tool
  • A tool from Docker to work with distributed deployments of containers.
  • A cluster of Docker hosts.

Q2. Which type of docker network is used to establish communication between different services?

  • Bridge
  • Host
  • Overlay

Q3. What is the right command to scale down a service running with 6 containers to 3 containers?

  • docker service <service_id> scale down 3
  • docker service scale <service_id>=3
  • docker services scale <service_id>=3
  • docker service <service_id> scale=3

Q4. How to list all the running containers or tasks of a stack?

  • docker stack ls
  • docker stack ps <stack_name>
  • docker stack services ps

Q5. Can you use build keyword in docker-compose.yml file while working on a swarm node?

  • Yes
  • No
  • Sometimes

I hope this Working with Containers: Docker & Docker Compose Educative Quiz Answers would be useful for you to learn something new from this problem. If it helped you then don’t forget to bookmark our site for more Coding Solutions.

This Problem is intended for audiences of all experiences who are interested in learning about Data Science in a business context; there are no prerequisites.

Keep Learning!

More Coding Solutions >>

LeetCode Solutions

Hacker Rank Solutions

CodeChef Solutions

Leave a Reply

Your email address will not be published. Required fields are marked *