-
What is Docker?
Answer: Docker is an open-source container service designed to facilitate applications deployment inside the software containers. It will rely on Linux Kernel Features like namespaces and cgroups ensuring which resource isolation and application packaging along with its dependencies. Docker was licensed under Apache License 2.0 in the binary form and fully written in the Go programming language. It can support several operating systems like Linux, Cloud, Windows, and Mac OS and different platforms like ARM architecture and x86-64 windows platforms.
-
Why use Docker?
Docker has the following benefits:
- A user can quickly build, ship, and run its applications.
- A single operating system kernel will run all containers.
- Docker container is more light-weight than the virtual machines.
- A user will deploy Docker containers anywhere, on any physical and virtual machines and even on the cloud.
3. List the most used commands of Docker.
Some common commands are:
- ps lists the running containers.
- dockerd launches Docker Daemon.
- build is used to build an image from a DockerFile.
- create is used to create a new image form container’s changes.
- pull is used to download a specific image or a repository.
- run is used to run a container.
- logs display the logs of a container.
- rm removes one or more containers. 9.rmi removes one or more images.
- stop is used to stop one or more container.
- kill is used to kill all running containers.
-
Does the data get lost, if the Docker container exits?
No. any data which application will write to disk can get well preserved in its container until we will explicitly delete the container and the file system will persist even after the container halts.
-
What is Dockerfile and its use?
DockerFile is a text document which is used to assemble a Docker image. It is consist of a list of Docker commands and operating system commands for building an image. These commands will execute automatically in sequence in the Docker environment and create a new Docker image.
-
How Docker is advantageous over Hypervisors?
Docker is advantageous in following ways:
-
How to create a Docker container?
A Docker Container will be created by running any specific Docker image. Use the following command to create a container .
docker run -t -i command name
If to verify that whether the container has created or whether that is running or not, use the following command as this command will lists out all the running Docker containers on the host along with their status.
docker ps -a
-
Can json be used instead of yaml for compose file?
Yes, json can be used instead of yaml for compose file.
-
How do I run multiple copies of Compose file on the same host?
Compose will use the project name which will allow to create unique identifiers for all of a project’s containers and other resources. To run multiple copies of a project, set a custom project name using the -a command-line option or using COMPOSE_PROJECT_NAME environment variable.
-
What are the components of Docker Architecture?
- Docker Client (docker) – it will enable a user for Docker interaction. It will communicate with more than one Docker Daemon. It can use Docker API and can send command ( docker run) to Docker Daemon ( dockerd ) which carries them out.
- Docker Daemon ( dockerd ) – It will give a complete environment to execute and run applications. It is consists of images, containers, volumes and responsible for all container-related actions. It can pull and create the container images as what the client requests. A Daemon will communicate with other daemons for its service management.
- Docker registry -is versioning, storage, and distribution system for Docker images. It allows Docker users to pull images locally, and push new images to the registry. Docker Hub is a public registry instance of Docker used by default while installing Docker Engine.
- Docker Image- is a lightweight, standalone, executable package of Docker stored in a Docker Registry. It can be used for creating a container. It will consist of everything required to run an application- code, a runtime, system libraries, system tools, environment variables, configuring files, and settings.
- Docker Container– It is a standardized unit of software used for deploying a particular application or environment. It is launched by running an image. It can package up code and all of its dependencies therefore apps will run quickly and reliably from one computing environment to another.
-
On what platforms does Docker run?
Docker will run on various platforms as follows:
- Linux
- Ubuntu 12.04, 13.04 et al Fedora 19/20+
- RHEL 6.5+
- CentOS 6+ Gentoo ArchLinux
- openSUSE 12.3+
- CRUX 3.0+
- Microsoft Windows
- Windows Server 2016
- Windows 10 Cloud
- Amazon EC2Google Compute Engine
- Microsoft Azure Rackspace
-
What is the purpose of Docker_Host?
It will contain container, images, and Docker daemon. It will offer a complete environment to execute and run application.
-
What is Docker Engine?
Docker Engine is a Client-Server application which is installed on the host machine. It will allows to develop, assemble, ship, and run applications anywhere. It can be available for Linux or Windows Server. Its major components are as follows:
-
Server is a long-running program which is called a Daemon process (docker )
-
REST API specifies interfaces which docker will use to communicate with Daemon and instruct it what to do.
-
CLI (Command Line Interface) – It will use the Docker REST API to manage and interact with the Daemon through its scripting commands.
14. What is the Lifecycle of Docker container?
Answer: The Lifecycle of Docker Container with CLI is as following:
-
Create a Container.
-
Run the created Container.
-
Pause the processes running inside the Container.
-
Unpause the processes running inside the Container.
-
Start the Container, if exists in a stopped state.
-
Stop the Container as well as the running processes.
-
Restart the Container as well as the running processes.
-
Kill the running Container.
-
Destroy the Container, only if it exists in a stopped state.
-
What is Kubernetes and Docker?
Docker is a platform and tool to build, distribute, and run Docker containers.
Kubernetes is a container orchestration system for Docker containers which is more extensive than Docker Swarm and will be meant to coordinate clusters of nodes at scale in production in an efficient manner.
-
When should I use Docker? When To Use Docker?
Use cases for Docker include:
-
Use Docker as version control system for entire app’s operating system.
-
Use Docker when want to distribute/collaborate on app’s operating system with a team.
-
Use Docker to run code on laptop in the same environment as we have on your server (try the building tool).
-
What is the advantage of Docker?
The most important advantages to a Docker-based architecture is actually standardization. Docker will provide repeatable development, build, test, and production environments. Every team member can work on a production parity environment by Standardizing service infrastructure across the entire pipeline.
-
Why is Docker needed?
Docker is required to ease the creation, deploy and the delivery of an application using the called Containers. A Docker Container has just the minimum set of operating system not a full operating system, a software required for the application to run and rely on the host Linux Kernel itself.
-
Is Kubernetes better than Docker?
Kubernetes and Docker isn’t an alternative of each other. Quite the contrary; Kubernetes will run without Docker and Docker will function without Kubernetes. Kubernetes will benefit greatly from Docker and vice versa. Docker is a standalone software which will be installed on any computer to run containerized applications.
-
What is the difference between Docker and Openshift?
The main difference between Docker and Openshift is that Docker as a project will focuse on the runtime container only, whereas OpenShift as a system will include both the runtime container along the REST API, coordination, and web interfaces for deploying and manage individual containers. A cartridge has similarity to a docker image.
-
What are the disadvantages of Docker?
Some disadvantages with Docker are:
-
Containers will not run at bare-metal speeds.
-
Containers consume resources more efficiently than virtual machines but still it is subject to performance overhead due to overlay networking, interfacing between containers and the host system and so on.
22. What is the most popular use of Docker?
The most common technologies running in Docker are:
-
NGINX: Docker is mostly used for deploying and run HTTP servers.
-
Redis: This popular key-value store is a regular feature a top the list of container images.
-
Postgres: The open source relational database is steadily increasing in popularity.
-
Should I use Docker for development?
The development environment is the similar as the production environment. We will deploy and it can “just work”. If it is hard time to build something by build or compile, build it inside Docker.
-
Is Docker a VM?
In a virtual machine, valuable resources will be emulated for the guest OS and hypervisor, that will make it possible to run many instances of one or more operating systems in parallel on a single machine or host. Docker containers are executed with the Docker engine not within the hypervisor.
-
Why is Docker so popular?
Docker is popular because it has revolutionized development.The main benefit is that containers create vast economies of scale.
-
How do I download Docker?
Following way Docker can be downloaded:
-
Install Docker for Mac
-
run it
-
Double-click Docker.dmg for openning the installer, then drag Moby the whale to the Applications folder.
-
Double-click Docker.app in the Applications folder to start Docker.
-
Click the whale ( ) to get Preferences and other options.
-
Select About Docker to verify that you have the latest version.
-
Talk about Docker performance?
Docker does well when compared to virtual machines in relation to performance, because containers will share the host kernel and will not emulate a full operating system. However, Docker does impose performance costs. If we required to get the best possible performance out of server, we may required to avoid Docker.
-
What can you do with Docker?
We are just some of the use cases which will provide a consistent environment at low overhead with the enabling technology of Docker.
-
Simplifying Configuration.
-
Code Pipeline Management.
-
Developer Productivity.
-
App Isolation.
-
Server Consolidation.
-
Debugging Capabilities.
-
Multi-tenancy.
-
What are Docker images?
A Docker image is a file which is comprised of multiple layers, used for executing code in a Docker container. An image will be essentially built from the instructions for a complete and executable version of an application, which will relies on the host OS kernel.
-
Is Docker a Microservice?
Docker will Benefits for Microservices. Docker, as a containerization tool, will be often compared to virtual machines. Virtual machines are introduced to optimize the use of computing resources. We will run several VMs on a single server and deploy each application instance on a separate virtual machine.
-
How much does Docker cost?
As of now, Docker offers three enterprise editions of its software. Pricing which is start at $750 per node per year.
-
What is docker in AWS?
Docker is a software platform which will allow to build, test, and deploy applications quickly. Running Docker on AWS will provide developers and admins a highly reliable, low-cost way for building, ship, and run distributed applications at any scale.
-
Is Kubernetes free?
Pure open source Kubernetes is free and it can be downloaded from its repository on GitHub. Administrators should build and deploy the Kubernetes release to a local system or cluster or to a system or cluster in a public cloud, such as AWS, Google Cloud Platform (GCP) or Microsoft Azure.
-
Difference between virtualization and containerization?
Containers will provide an isolated environment to run the application. The entire user space will be explicitly dedicated to the application. Any changes which are made inside the container will never reflected on the host or even other containers running on the same host. Containers will be an abstraction of the application layer. Each container has a different application.
In virtualization, hypervisors will provide an entire virtual machine to the guest including Kernel. Virtual machines will be an abstraction of the hardware layer. Each VM is a physical machine.
-
Explain how you can clone a Git repository via Jenkins?
To clone a Git repository via Jenkins, we have to enter the e-mail and user name for Jenkins system. To do that we have to switch into job directory and execute the “git config” command.
-
What is a Docker Container and its advantages?
Docker containers will include the application and all of its dependencies. It will share the kernel with other containers, running as isolated processes in user space on the host operating system. Docker containers will not required any specific infrastructure, they will run on any infrastructure, and in any cloud. Docker containers will be basically runtime instances of Docker images.
Following are major advantage of using Docker Container:-
-
It will offer an efficient and easy initial set up.
-
It will allow to describe application lifecycle in detail.
-
Simple configuration and interacts with Docker Compose.
-
Documentation will provide every bit of information.
37. Explain Docker Architecture?
Docker Architecture will consist of a Docker Engine that is a client-server application:-
-
A server which is a type of long-running program which is called a daemon process ( the docker command ).
-
A REST API which will specify interfaces that programs will use to talk the daemon and instruct it what to do.
-
A command-line interface (CLI) client (the docker command) The CLI will use the Docker REST API to control or interact with Docker daemon applications use the underlying API and CLI.
-
What is Docker Hub?
Docker hub is a cloud-based registry that will help us to link code repositories. It will allows us to build, test, store image in the Docker cloud. We can deploy the image to host with the help of the Docker hub.
-
What are the important features of Docker?
Following are the essential features of Docker:
-
Easy Modeling
-
version Control
-
Placement/Affinity
-
Application Agility
-
Developer Productivity
-
Operational Efficiencies
40. What are the main drawbacks of Docker?
Following are the disadvantages of Docker which we should keep in mind
-
It will not provide a storage option.
-
Offer a poor monitoring option.
-
No automatic rescheduling of inactive Nodes.
-
Complicated automatic horizontal scaling set up.
-
Tell us something about Docker Compose.
Docker Compose is a YAML file which will contain details about the service, network, and volumes to set up the Docker application. Therefore, we will use Docker compose for creating separate containers, host them and get them to communicate with other containers.
-
What is Docker Swarm?
Docker Swarm is native clustering for Docker. It will turn a pool of Docker hosts into a single, virtual Docker host. Docker Swarm will serve the standard Docker API, any tool which already communicates with a Docker daemon will be use Swarm to transparently scale to multiple hosts.
-
What is Docker Engine?
Docker daemon or Docker engine will represent the server. The docker daemon and the clients will run on the same or remote host, which will communicate through command-line client binary and full RESTful API.
-
Explain Registries
The two types of registry are
-
Public Registry
-
Private Registry
Docker’s public registry is called Docker hub, which will allow to store images privately. In Docker hub, we will store millions of images.
-
What command should you run to see all running container in Docker?
$docker ps
-
Write the command to stop the Docker Container.
$ sudo docker stop container name
-
What is the command to run the image as a container?
$ sudo docker run -i -t alpine /bin/bash
-
Explain Docker object labels.
Docker object labels is a method to apply metadata to docker objects which will include images, containers, volumes, network, swarm nodes, and services.
-
Write a Docker file to create and copy a directory and built it using python modules?
FROM pyhton:2.7-slim
WORKDIR /app
COPY . /app
docker build –tag
-
Where the docker volumes are stored?
We required to navigate to: /var/lib/docker/volumes
-
How do you run multiple copies of Compose file on the same host?
Compose will use the project name which will allow us for creating unique identifiers for all of a project’s containers and other resources. To run multiple copies of a project, set a custom project name using the -a command-line option or using COMPOSE_PROJECT_NAME environment variable.
-
Did Docker come up with the ‘container’ technology?
No, Docker did not come up with the container technology. Multiple other development tools offer containers similar to Docker.
-
How is Docker better than other tools that use containers, then?
Docker will utilise the cloud to run its container-related operations – which is not used by many other development tools. Docker has become much more flexible and adaptable to different scenarios using the cloud, which might come up during the development or shipment processes. This is the main reason to use the Docker when compared to other container-based developer tools.
-
What is a Dockerfile?
A Dockerfile is a set of instructions. Developers provided Docker with such instructions therefore the program could do the job correctly, with those specific parameters in mind.
-
What are the three main types of Docker components?
The Client, the Host, and the Registry.
The client is the component which will issue “run” and “build” commands to the host. The host is where all of the containers and images will be created. They will be then sent to the registry, for execution.
-
Will you lose all of your work if you accidentally exit a container?
No, We won’t lose any information, data and other parameters if we accidentally exit the Docker container. The only way to lose progress would be to issue a specific command to delete the container – exiting it won’t do the files within any harm.
-
Can you use any other files for composing instead of the default YAML?
Yes, The more popular version to use than YAML is the good-old JSON.
-
What is ‘NameSpaces’ used for?
NameSpaces will isolate the Docker containers from other activities or tampering with them.
-
What is the single most important requirement for building a Docker container?
The most important requirement for building a container with Docker is the default image. This default image will vary depending on the code that we are using. To find out and access the default image, we should go to the Docker Hub and search for the specific domain that we required. After we
find the image, all that’s left to do is deal with the documentation and that’s it – we can create a Docker container.
-
How does Docker manage ‘Dockerized nodes’?
A Dockerized node can be any machine which has Docker installed and running. Docker will manage both in-house and cloud-based nodes. Therefore, whether the node will exist in the area of the main computer running Docker or it is present on the cloud – it will not matter. Docker can manage it without a problem.
-
What are the main factors that dictate the number of containers you can run?
There is no defined limit of containers that we can run with Docker. The limitations may start due to hardware.
Two factors might limit the number of containers that we can run – the size of app and CPU strength. If application isn’t ginormous and we have a never-ending supply of CPU power, we could probably run a huge amount of Docker container simultaneously.
-
How is Docker different from Hypervisor?
Hypervisor will require to have extensive hardware to function properly, while Docker will run on the actual operating system. This will allow Docker to be exceptionally fast and perform tasks in a fluid manner – something which Hypervisor tends to lack.
-
Can I use JSON instead of YAML for my compose file in Docker?
YES, We can very comfortably use JSON instead of the default YAML for Docker compose file. In order to use JSON file with compose, we required to specify the filename to use as the following:
docker-compose -f docker-compose.json up
-
Tell us how you have used Docker in your past position?
We could also explain the ease that this technology has brought in the automation of the development to production lifecycle management. We can also discuss about any other integrations that we might have worked along with Docker like Puppet, Chef or even the most popular of all technologies – Jenkins.
-
How to create Docker container?
We will create a Docker container out of any specific Docker image of choice and the same can be achieved using the command given below:
docker run -t -i command name
The command above can create the container . In order to check whether the Docker container will be created and whether it is running or not, we could make use of the following command. This command can list out all the Docker containers along with its statuses on the host that the Docker container runs.
docker ps –a
-
How to stop and restart the Docker container?
The following command will be used to stop a certain Docker container with the container id as CONTAINER_ID:
docker stop CONTAINER_ID
The following command will be used to restart a certain Docker container with the container id as CONTAINER_ID:
docker restart CONTAINER_ID
-
How far do Docker containers scale?
The Web deployments such as Google, Twitter and best examples in the Platform Providers such as Heroku, dotCloud run on Docker that can scale from the ranges of hundreds of thousands to millions of containers running in parallel, provided the condition which the OS and the memory will not run out from the hosts which runs all these innumerable containers hosting your applications.
-
What platforms does Docker run on?
Docker will currently available on the following platforms and also on the following Vendors or Linux:
1. Ubuntu 12.04, 13.04
-
Fedora 19/20+
-
RHEL 6.5+ 4 CentOS 6+
-
Gentoo
-
ArchLinux
-
openSUSE 12.3+
-
CRUX 3.0+
Docker will currently available and run on the following Cloud environment setups as following:
-
Amazon EC2
-
Google Compute Engine
-
Microsoft Azure
-
Rackspace
Docker is extending it will support to Windows and Mac OSX environments and support on Windows has been on the growth in a very drastic manner.
-
What is the advantage of Docker over hypervisors?
Answer: Docker is lightweight and more efficient in resource uses because it will use the underlying host kernel rather than creating its hypervisor.
-
Is Container technology new?
No, container technology is not new. Different variations of containers technology ate out there in *NIX world for a long time. Solaris container (aka Solaris Zones)-FreeBSD Jails-AIX Workload Partitions (aka WPARs)-Linux OpenVZ are examples.
-
How is Docker different from other container technologies?
Docker is a quite fresh project. It was created in the Era of Cloud, Therefore a lot of things are better than in other container technologies. Following are the features which are good in Docker:
-
Docker will run on any infrastructure, we can run docker on laptop, or can run it in the cloud.
-
Docker has a Container HUB which is a repository of containers that can download and use. We can even share containers with any applications.
-
Docker is quite well documented.
-
What are the networks that are available by default?
bridge It is the default network all containers connect to if we will not specify the network. none connects to a container-specific network stack which will lack a network interface
host connects to the host’s network stack – there will be no isolation between the host machine and the container, as far as network is concerned
-
Difference between Docker Image and container?
The runtime instance of docker image is the Docker container. Docker Image will not have a state, and its state will never change as it will just set of files whereas docker container will have its execution state.
-
What is the use case for Docker?
There are use cases where we can use Docker in production.
-
How exactly are containers (Docker in our case) different from hypervisor virtualization (vSphere)? What are the benefits?
To run an application in a virtualized environment (example for vSphere), we first required for creating a VM, install an OS inside and only then deploy the application. To run the same application in docker, all we required is to deploy that application in Docker. There is no need for additional OS layer. We just deploy the application with its dependent libraries, docker engine (kernel, etc.) which will provide the rest.