0% found this document useful (0 votes)
12 views9 pages

Docker Python App

This document outlines the requirements and steps to create a Dockerized Python application using VS Code. It includes instructions for setting up a Dockerfile, building a Docker image, and pushing it to Docker Hub. Additionally, it explains how to pull pre-built images from Docker Hub for use.

Uploaded by

panderudraksh
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
12 views9 pages

Docker Python App

This document outlines the requirements and steps to create a Dockerized Python application using VS Code. It includes instructions for setting up a Dockerfile, building a Docker image, and pushing it to Docker Hub. Additionally, it explains how to pull pre-built images from Docker Hub for use.

Uploaded by

panderudraksh
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 9

Requirement

• 4+GB RAM
• Docker Desktop for windows/mac
• Profile on docker hub
• Vs code ---docker extension
Docker Desktop for windows
Profile on docker hub
Vs code ---docker extension
Step-1
Open VS CODE make two separate file
1.Python file
2.Docker file

Step -2
Create Python app name it as anything in my case I name it as app.py
#write that code
a=“Hello this my demo docker project”
print(a)
STEP 3. CREATE AND BUILD THE DOCKER IMAGE

1 - Create the Dockerfile with the following contents:-


FROM python:latest
CMD ["python","app.py"]
COPY app.py / app.py
• STEP 4 WRITE FOLLOWING DOCKER COMMAND IN
TERMINAL
1. docker build -t imagename .
(give any random image name as per your choice)

2. docker image ls

3. docker login

4 docker tag imagename dockerhub


username/imagename

5 docker push <username>/imagename


6.docker run imagename
Pull a image from docker hub
• Docker Hub contains many pre-built images that you can pull and try
without needing to define and configure your own.
• To download a particular image, or set of images (i.e., a repository),
use docker pull.
• For Example –
• docker pull hub username/imagename
• Now you can run it using docker run command as previously.
• docker run hubusername/imagename

You might also like