Experiment 4
Experiment 4
Experiment No: 4
Title: Docker
Aim and Objective of the Experiment:
Aim: Docker – Container - Installation of Docker on Linux / Windows and creating
Containers
Objective :
• Environment Consistency: Docker allows applications to run consistently across different
environments, avoiding compatibility issues.
• Portability: Containers can run on any system with Docker installed, making applications
easy to transfer and deploy.
• Resource Efficiency: Containers share the OS kernel and have minimal overhead, allowing
efficient use of resources.
• Scalability: Containers are ideal for scaling applications horizontally by creating multiple
instances as needed.
• Isolation: Containers run in isolated environments, ensuring security and minimizing
interference between applications.
COs to be achieved:
1. Installing Docker
2. Creating container in docker
Somaiya Vidyavihar University
K. J. Somaiya College of Engineering, Mumbai-77
Department of Computer Engineering
• Linux: Docker is successfully installed, with the Docker daemon running and enabled at
startup.
• Windows: Docker Desktop installs successfully, launches without errors, and is
integrated with WSL 2 if on Windows 10/11.
• Running Containers: Using docker ps, you should see a list of running containers
with details like container ID, image name, and status.
• Stop and Start: Commands like docker stop <container_id> and docker start
<container_id> should operate as expected, allowing you to control container
lifecycle.
• Efficient Resource Use: Containers should use system resources efficiently, showing
low overhead when multiple containers are run concurrently.
4. Deployment Consistency:
• Portability: Created containers should run identically on any system where Docker is
installed, allowing for consistent deployment across environments.
• Reproducibility: By pulling the same image and running it, the application setup should
be consistent and reproducible on different systems.
Related Theory:
Docker is a platform that uses OS-level virtualization to deliver software in packages called
containers. Containers are lightweight, standalone, executable software packages that
include everything needed to run an application, including code, runtime, libraries, and
configurations.
Docker
• Portability: Docker containers can run on any machine with Docker installed, providing
a consistent environment across development, testing, and production.
• Resource Efficiency: Containers share the same OS kernel, making them more
lightweight than traditional virtual machines.
• Scalability: Docker makes it easy to scale applications horizontally by adding more
containers.
Python
Python is a high-level, interpreted programming language known for its simplicity and
versatility. It's widely used in web development, data science, machine learning, automation,
and more.
1. Easy Syntax: Python's syntax is clean and simple, making it accessible for beginners
and efficient for experienced developers.
2. Rich Standard Library and Ecosystem: Python has a large standard library and a vast
ecosystem of third-party libraries (e.g., NumPy, Pandas, Django, Flask) that extend its
functionality for a variety of tasks.
3. Cross-Platform Compatibility: Python code can run on any operating system with a
Python interpreter (e.g., Windows, macOS, Linux).
Somaiya Vidyavihar University
K. J. Somaiya College of Engineering, Mumbai-77
Department of Computer Engineering
4. Dynamic Typing: Python uses dynamic typing, which means variables don’t need
explicit type declaration, improving development speed.
Implementation details:
Step 1: Download Docker Desktop
Go to the Docker Desktop for Windows download page and download the
installer.
Run the Docker Desktop installer and follow the installation instructions. Make sure to:
• Enable WSL 2 during installation for improved performance (for Windows 10/11).
• Restart your computer if prompted.
Somaiya Vidyavihar University
K. J. Somaiya College of Engineering, Mumbai-77
Department of Computer Engineering
Launch Docker Desktop from the Start menu. Once started, Docker should run in the system
tray.
Somaiya Vidyavihar University
K. J. Somaiya College of Engineering, Mumbai-77
Department of Computer Engineering
Conclusion:-
Docker provides a powerful, consistent, and efficient solution for running applications in
isolated environments called containers. By setting up Docker on Linux or Windows, you can
build, test, and deploy applications with minimal setup across various systems. Containers
streamline the development and deployment process, offering significant advantages in
portability, scalability, and resource efficiency.
Following the installation and container creation steps allows you to:
Mastering Docker is a valuable skill, enabling faster, more reliable, and portable application
deployment across development, testing, and production environments.