What is a Docker container? How do you create, start and stop containers?
Docker is a containerization technology that packages your application and all its dependencies together in the form of Containers to ensure that your application works seamlessly in any environment.
A container consists of an entire runtime environment: an application, plus all its dependencies, libraries and other binaries, and configuration files needed to run it, bundled into one package.
Containerizing the application platform and its dependencies eliminates any infrastructure differences and maintains consistency across environments.
They share the kernel with other containers, running as isolated processes in user space, on the host operating system.
Docker containers can be created by either creating a Docker image and then running it or you can use Docker images that are present on the Docker hub.
We can use Docker image to create Docker container by using the below command:
docker run -t -i <image name> <command name>
This command will create and start container.
Docker container can be run in two modes:
Attached: Where it will be run in the foreground of the system you are running, provides a terminal inside to container when -t option is used with it, where every log will be redirected to stdout screen.
Detached: This mode is usually run in production, where the container is detached as a background process and every output inside the container will be redirected to log files which can be viewed by docker logs command.
To check the list of all running containers with status on a host:
docker ps -a
To stop the Docker container:
docker stop <container ID>
To restart the Docker container you can use:
docker restart <container ID>
More DevOps Interview Questions by Devlabs Alliance
- How do all the automation tools work together in a CICD flow?
- What is Nagios? DevOps Interview Questions
- What is CI? What is its purpose?
- Difference between Git and SVN| DevOps Interview Question
- Which among Puppet, Chef, SaltStack and Ansible is the best Configuration Management (CM) tool and Why?
- Robotic Process Automation – An ultimate solution
- Process Automation and Mitigating Risks during Natural Disasters
- Advanced Selenium Interview Questions
- JIRA Interview Question
- Robotic Process Automation in Healthcare Industry
- What is Microservices Architecture
- Robotic Process Automation Simplified
- Setup Selenium with C#
- SDET Demand In Market !!
- Top 5 API Testing Tools
- Vijay Kumar
Excellent Training program. Training courses and trainers are very good. Trainer will explain you as many time you ask the question. Best thing is hands on based training. You learn by doing. Looking for more courses from here.
- sairam shyamala
It was good session, I left my training room with basic knowledge on all the tools. Tutors have great knowledge and experience on the tools. But three days is not enough time.
- Salaja K
Training provided by the trainers in DevLabs Alliance is completely awesome. Trainers are highly qualified in their areas with practical experience. Since it is 3 days training we have completely got the opportunity to have hands on.
- Varenya Varshney
Both trainers (Ravi and Naresh) were excellent in their approach. Session was less of a theory and more of a practical. And even the theory part was quite interesting. A bit issue with the volume of information which I had received in just a span of 2-3 days - it seemed a bit over-loaded. But overall, it has given me a great platform to take it forward from here!
- Abhishek Tripathi
Training provided by the trainers here is completely awesome. Trainer is highly qualified in their areas with practical experience. Also amenities provided during training by institute is great