Docker Interview Questions and Answers
Ques 11. Explain the difference between Docker containers and virtual machines.
Docker containers share the host OS kernel, making them more lightweight and faster than virtual machines. VMs, on the other hand, run a full OS, leading to higher resource overhead.
Ques 12. What is the purpose of the ENTRYPOINT instruction in a Dockerfile?
The ENTRYPOINT instruction sets the command that will be executed when a container is run. It provides the default executable for the container and can be overridden at runtime.
Example:
ENTRYPOINT ["/usr/bin/myapp"]
Ques 13. How do you check the logs of a running Docker container?
You can use the `docker logs` command followed by the container ID or name to view the logs of a running container.
Example:
docker logs container_name
Ques 14. What is the purpose of Docker Hub?
Docker Hub is a cloud-based registry service that allows developers to share and distribute Docker images. It serves as a central repository for Docker images.
Ques 15. Explain the concept of Docker Networking.
Docker Networking enables communication between containers and external networks. It provides various network drivers, such as bridge, host, overlay, and macvlan.
Most helpful rated by users: