Top 100 Docker Interview Questions and Answers

Updated 22 Nov 2024

Q101. Why is docker system prune used?

Ans.

docker system prune is used to clean up unused Docker resources.

  • docker system prune helps to free up disk space by removing unused containers, images, networks, and volumes

  • It can be used to remove stopped containers, dangling images, unused networks, and unused volumes

  • The command can be customized with flags to specify which resources to prune

  • Example: docker system prune -a removes all unused resources, including stopped containers and unused images

Add your answer
Frequently asked in

Q102. What is docker, what is DevOps

Ans.

Docker is a containerization platform that allows applications to be packaged and run in isolated environments. DevOps is a software development methodology that focuses on collaboration, automation, and integration between development and operations teams.

  • Docker is a tool designed to make it easier to create, deploy, and run applications by using containers.

  • Containers allow a developer to package up an application with all parts it needs, such as libraries and other dependen...read more

Add your answer

Q103. wha t is docker

Ans.

Docker is a platform that allows you to package, distribute, and run applications in containers.

  • Docker is a tool designed to make it easier to create, deploy, and run applications by using containers.

  • Containers allow a developer to package up an application with all parts it needs, such as libraries and other dependencies, and ship it all out as one package.

  • Docker containers are lightweight and share the same operating system kernel, making them more efficient than virtual ma...read more

Add your answer
Frequently asked in

Q104. what is docker and why we use it.

Ans.

Docker is a containerization platform that allows developers to package applications with all dependencies into a standardized unit for easy deployment.

  • Docker allows for consistent development, testing, and deployment environments across different systems.

  • It improves scalability and resource utilization by isolating applications in lightweight containers.

  • Docker simplifies the process of managing dependencies and configurations, making it easier to deploy applications in vario...read more

Add your answer
Frequently asked in
Are these interview questions helpful?

Q105. What is Workspaces in docker

Ans.

Workspaces in Docker are isolated environments where developers can work on different projects without affecting each other.

  • Workspaces allow developers to have separate environments for each project, preventing conflicts between dependencies.

  • Each workspace has its own set of containers, volumes, and networks, ensuring isolation.

  • Developers can easily switch between workspaces to work on different projects.

  • Workspaces are useful for managing multiple projects or versions of the ...read more

Add your answer
Frequently asked in

Q106. Why is docker ps command used?

Ans.

The docker ps command is used to list all the running containers on a Docker host.

  • It provides information about the container ID, image used, command being run, status, ports, and names of the running containers.

  • It helps in monitoring and managing the containers on a Docker host.

  • The command can be used with various options to filter and format the output as per requirements.

  • Example: 'docker ps -a' lists all containers, including the ones that are not running.

  • Example: 'docker ...read more

View 1 answer
Frequently asked in
Share interview questions and help millions of jobseekers 🌟

Q107. Best practices for Docker file

Ans.

Best practices for Dockerfile include keeping it simple, using official images, and minimizing layers.

  • Use official images as base

  • Minimize layers to reduce image size

  • Avoid installing unnecessary packages

  • Use .dockerignore to exclude unnecessary files

  • Specify version numbers for packages

  • Use multi-stage builds for complex builds

  • Run only one process per container

  • Use environment variables for configuration

  • Keep the Dockerfile simple and readable

Add your answer

Q108. What is docker and difference b/w docker attach and docker exec

Ans.

Docker is a containerization platform that allows developers to package, deploy, and run applications in isolated environments.

  • Docker attach allows you to attach to a running container's console output, while docker exec allows you to run a command inside a running container.

  • Docker attach is used to view the output of a container, while docker exec is used to execute a command inside a container.

  • Docker attach is used for debugging purposes, while docker exec is used for runni...read more

Add your answer

Docker Jobs

DevOps Engineer 8-12 years
Intel Technology India Pvt Ltd
4.2
Bangalore / Bengaluru
Sr Software Engineer - Backend 8-13 years
Uber
4.2
Bangalore / Bengaluru
Salesforce Marketing Cloud Developer 5-6 years
Schneider Electric India Pvt. Ltd.
4.1
Bangalore / Bengaluru

Q109. What is docker attached and detached mode how to get out of docker exec without closing the terminal of docker exec

Ans.

Docker attached mode runs a container in the foreground, while detached mode runs it in the background.

  • In attached mode, you can see the container's output in the terminal where it was started.

  • In detached mode, the container runs in the background and you can continue using the terminal.

  • To exit a Docker exec session without closing the terminal, press Ctrl + P, Ctrl + Q.

  • You can also use the command 'exit' or 'Ctrl + D' to exit the Docker exec session.

Add your answer
Frequently asked in

Q110. How docker works and kunermates

Ans.

Docker is a platform for developing, shipping, and running applications in containers. Kubernetes is an open-source system for automating deployment, scaling, and management of containerized applications.

  • Docker allows developers to package applications and their dependencies into containers for easy deployment and scalability.

  • Kubernetes helps in automating the deployment, scaling, and management of containerized applications across a cluster of nodes.

  • Docker containers are lig...read more

Add your answer
Frequently asked in
1
2
Interview Tips & Stories
Ace your next interview with expert advice and inspiring stories

Interview experiences of popular companies

3.7
 • 10.5k Interviews
3.6
 • 7.7k Interviews
3.7
 • 4.8k Interviews
3.8
 • 3k Interviews
4.0
 • 2.4k Interviews
3.7
 • 585 Interviews
3.7
 • 538 Interviews
3.8
 • 510 Interviews
4.1
 • 432 Interviews
3.6
 • 44 Interviews
View all
Docker Interview Questions
Share an Interview
Stay ahead in your career. Get AmbitionBox app
qr-code
Helping over 1 Crore job seekers every month in choosing their right fit company
75 Lakh+

Reviews

5 Lakh+

Interviews

4 Crore+

Salaries

1 Cr+

Users/Month

Contribute to help millions

Made with ❤️ in India. Trademarks belong to their respective owners. All rights reserved © 2024 Info Edge (India) Ltd.

Follow us
  • Youtube
  • Instagram
  • LinkedIn
  • Facebook
  • Twitter