Docker 101 : Getting Started

sandeep negi
2 min readJul 20, 2021


So here i am back again with some easy steps to learn docker

I am assuming you have already installed the docker and configured it.

Now lets learn all the command

docker ps// this will showcase all the container that are runningdocker stop container-name//this command will stop the container for which the name is mentioneddocker run -d -p 1111:80 --name sandy-123 prakhar1989/static-site// here 
-d means detached mode means it will not be attached to current terminal
-p : when we want to map the system ports map to container ports : 1111:80 --> menas 1111 of local port is mapped to 80 of the container port we can mention like this --name : by this we can give any name to the container
docker stop sandy-123
// this command will stop the named container

above mentioned 1,2,3 are the commands and it basically explain everything which is mentioned above

How to create your own docker image ?

  • docker images →this will list all the images present in our system
  • consider a single image as a git repository so it means that we can have multiple versions of a single image.
  • we can mention which version we wants to pull

base images → has no parent

child images → base image + additional functionality

so we will clone one git repository with som sample application

and then we will create image for that using some base image.


  • content of docker file

here we first importing base image that is python 3

second WORKDIR will create a directory and then cd to that directory

then we are copying everything in the current dir

installing all the packages

exposing port of the container

cmd command to run the project

FROM python:3WORKDIR /usr/src/appCOPY . .RUN pip install — no-cache-dir -r requirements.txtEXPOSE 5000CMD [“python”,”./”]

once the docker file is prepared create a image out of it

do not forget the .

this will command will pick the docker file from the directory and create a image from that

docker build -t sandeepnegi1996/anyname .

now this command run the container in detact mode local post 1111 map to 5000 and name of container is “- “ “-” name anyNameForContainer and then give the image name

docker run -d -p 1111:5000 — name “anyNameforContainer” sandeepnegi1996/anyname



sandeep negi

Software Engineer, who loves challenges and new technologies. :)