Skip to content

rahulshukla29081999/docker-CheatSheet

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

1 Commit
Β 
Β 

Repository files navigation

Docker HandsOn πŸš€

This repository contains my hands-on practice and revision notes for Docker.
It includes commands, outputs, and experiments with images, containers, and networking.


πŸ“Œ Overview

  • Practiced pulling and running Docker images (nginx, python).
  • Explored container lifecycle: start, stop, remove, restart.
  • Worked with port mapping (-p 8080:80) to access services locally.
  • Used docker exec to interact with containers and create files/directories.
  • Learned about auto-removal containers (--rm) and naming containers (--name).
  • Inspected container details using docker inspect.

πŸ›  Commands Practiced

Basic Commands

  • docker -v β†’ Check Docker version
  • docker pull nginx β†’ Pull latest Nginx image
  • docker image ls β†’ List available images
  • docker ps / docker ps -a β†’ List running/all containers

Running Containers

  • docker run nginx:latest β†’ Run Nginx interactively
  • docker run -d nginx β†’ Run Nginx in detached mode
  • docker run -d --rm --name nc -p 8080:80 nginx β†’ Run Nginx with auto-remove, custom name, and port mapping

Container Management

  • docker stop <container_name> β†’ Stop a container
  • docker start <container_name> β†’ Restart a stopped container
  • docker rm <container_name> β†’ Remove a container
  • docker rm -f <container_name> β†’ Force remove a running container

Debugging & Logs

  • docker logs <container_name> β†’ View container logs
  • docker logs -f <container_name> β†’ Follow logs in real-time
  • docker inspect <container_name> β†’ Inspect container details

Inside Container

  • docker exec -it <container_name> bash β†’ Open bash shell inside container

  • cd /usr/share/nginx/html β†’ Navigate to Nginx default HTML directory

  • Created custom directory and file:

    docker exec nc mkdir rahul
    docker exec -it nc bash
    cd rahul
    touch rahul.txt
    
    

πŸ“‚ Repo Structure Code docker_revision/

β”œβ”€β”€ README.md # Documentation (this file)

🌐 Accessing Nginx

After running:

bash docker run -d --rm --name nc -p 8080:80 nginx Open http://localhost:8080 (localhost in Bing) in your browser to see the Nginx welcome page.

About

🎯Hands‑on Docker practice and revision notes β€” includes commands, outputs, and experiments with images, containers, networking, and lifecycle management. A practical guide for learning and revising Docker fundamentals.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors