Skip to content

kaustubholpadkar/Docker-Python-Application

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Docker-Python-Application

Running Simple Python Application in Docker container

Overview

This project aims at running a simple Python script through the docker container. We will create a python script app.py that performs addition of two integers as well as Dockerfile for building an image.

Step 1: Create 'app.py'

def main ():

	print('Enter First Number : ', end="")
	first_number = int(input())
	print('Enter Second Number : ', end="")
	second_number = int(input())

	total = first_number + second_number

	print('Addition of two numbers is ' + str(total))

if __name__ == '__main__':
	main()

Step 2: Create 'Dockerfile'

FROM python:3

WORKDIR /usr/src/app

COPY . .

CMD [ "python", "./app.py" ]

Step 3: Build Image

$ sudo docker build -t additionapp/1 .

Step 4: Run Container

$ sudo docker run -it additionapp/1
Enter First Number : 10
Enter Second Number : 20
Addition of two numbers is 30

About

Running Simple Python Application in Docker container

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages