https://github.com/kaustubholpadkar/docker-python-application
Running Simple Python Application in Docker container
https://github.com/kaustubholpadkar/docker-python-application
docker python3
Last synced: 3 months ago
JSON representation
Running Simple Python Application in Docker container
- Host: GitHub
- URL: https://github.com/kaustubholpadkar/docker-python-application
- Owner: kaustubholpadkar
- License: gpl-3.0
- Created: 2018-07-05T13:13:09.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2018-07-06T06:17:51.000Z (over 7 years ago)
- Last Synced: 2025-02-09T12:32:06.787Z (8 months ago)
- Topics: docker, python3
- Language: Python
- Size: 15.6 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# 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'
```pythondef 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'
```terminal
FROM python:3WORKDIR /usr/src/app
COPY . .
CMD [ "python", "./app.py" ]
```## Step 3: Build Image
```terminal
$ sudo docker build -t additionapp/1 .
```## Step 4: Run Container
```terminal
$ sudo docker run -it additionapp/1
Enter First Number : 10
Enter Second Number : 20
Addition of two numbers is 30
```