RATAN TATA MAHARASHTRA STATE SKILLS UNIVERSITY
School of Science Engineering and Technology Skills Department of Engineering
Subject –DevOps and Automation Lab
Lab Assignment 5 :
Install Docker and run basic container operations
Introduction to Docker
Docker is an open-source platform that enables developers to build, deploy, run, update,
and manage containers. It standardizes software delivery by packaging code and all its
dependencies into a single, standardized unit, ensuring the application runs consistently
across different computing environments.
Containers vs. Virtual Machines (VMs): VMs require a hypervisor and run a full, heavy
guest operating system for each application. Containers, on the other hand, share the
host system's OS kernel. This makes containers significantly lighter, faster to start, and
less resource-intensive than VMs.
Key Components of Docker:
• Docker Engine: The core client-server application that builds and runs
containers.
• Docker Images: Read-only templates containing the instructions for creating a
Docker container (it includes the code, runtime, libraries, and environment
variables).
• Docker Containers: The runnable, isolated instances of a Docker image.
• Docker Hub: A public cloud-based registry maintained by Docker where you can
find, share, and pull pre-built container images.
Execution Procedure & Screenshot Placement Guide
Follow these logical steps in your terminal to cover all the required operations. Take
screenshots at each indicated point.
Step 1: Verify Installation and Check Info
Open your terminal and run docker --version. Then, run docker info.
Step 2: Working with Docker Images
Pull a web server image from Docker Hub by running docker pull nginx.
Once it downloads, verify it is on your system by running docker images.
Step 3: Running and Managing Containers
Start the container in detached mode (so it runs in the background), assign it a
name, and map your host machine's port 8080 to the container's port 80 . Run
this command: docker run -d --name my-nginx -p 8080:80 nginx
Run docker ps to see the currently running container.
Step 4: Inspecting, Logs, and Executing Commands Inside
View the application logs by running docker logs my-nginx.
Access the running container's shell by running docker exec -it my-nginx
/bin/bash. Once inside (your prompt will change), run simple Linux commands
like ls and pwd, then type exit to return to your host terminal.
Step 5: Stopping and Cleanup
Stop the container gracefully by running docker stop my-nginx.
Verify it is stopped by running docker ps -a (which lists stopped containers
too).
Remove the stopped container using docker rm my-nginx , and then delete the
image using docker rmi nginx.