top of page

How to install Docker and use it ?

STEP 1: Install Docker Desktop (Free)

  1. Go to https://www.docker.com/products/docker-desktop/

    ree
  2. Click “Download for Windows”.

  3. Run the downloaded file → follow installer steps → keep default settings.

  4. Restart your computer if asked.

  5. Open Docker Desktop → wait till it says “Docker is running”.

    ree
  6. Check in Command Prompt:

    docker --version

    ree

    If it shows a version, Docker is ready.


🧱STEP 2: Pull and Run a Container

Now let’s run some ready-made containers.

  1. Open Command Prompt or PowerShell.

  2. Run this:

    docker run hello-world

    This tests your Docker setup. If you see “Hello from Docker!”, everything works fine.

    ree
  3. Run a small web server:

    docker run -d -p 8080:80 nginx


    -d → run in background

    -p 8080:80 → open it on port 8080


  4. Open your browser → go to http://localhost:8080


  5. You’ll see the NGINX welcome page.


STEP 3: Create Your Own Simple Docker App

Let’s make a small Python app and put it in a Docker image.


Step 3.1 — Create folder

Create a folder anywhere, like:

C:\docker-flask-app

Open Notepad, paste the following, and save as app.py inside that folder:

from flask import Flask
app = Flask(__name__)

@app.route('/')
def home():
    return "Hello from my first Docker app!"

if __name__ == '__main__':
    app.run(host='0.0.0.0', port=5000)

Also create a file named requirements.txt in the same folder:

flask

Now create another file named Dockerfile (no extension):

FROM python:3.10
WORKDIR /app
COPY . /app
RUN pip install -r requirements.txt
EXPOSE 5000
CMD ["python", "app.py"]

Step 3.2 — Build your Docker image

Open Command Prompt inside your folder (Shift + Right Click → “Open PowerShell window here”)

Run:

docker build -t myflaskapp .

Wait for it to finish.


Step 3.3 — Run your container

docker run -d -p 5000:5000 myflaskapp

Now open your browser → visit👉 http://localhost:5000

You’ll see:“Hello from my first Docker app!”


That’s it!

You have done:

  1. Installed Docker

  2. Pulled and ran containers

  3. Created your own custom image

$50

Product Title

Product Details goes here with the simple product description and more information can be seen by clicking the see more button. Product Details goes here with the simple product description and more information can be seen by clicking the see more button

$50

Product Title

Product Details goes here with the simple product description and more information can be seen by clicking the see more button. Product Details goes here with the simple product description and more information can be seen by clicking the see more button.

$50

Product Title

Product Details goes here with the simple product description and more information can be seen by clicking the see more button. Product Details goes here with the simple product description and more information can be seen by clicking the see more button.

Recommended Products For This Post
 
 
 

Comments


© 2023 by newittrendzzz.com 

  • Facebook
  • Twitter
  • Instagram
bottom of page