Basic Python Program

python

# myapp.py
num1 = int(input('Enter the first no '))
num2 = int(input('Enter the second no '))
print(f'Sum: {num1 + num2}')

Dockerfile

dockerfile

FROM python
WORKDIR /myapp
COPY ./myapp.py .
CMD ["python", "myapp.py"]

Running the Container

❌ Normal Mode (Fails)

bash

docker run <image_id>

Error: EOFError: EOF when reading a line

✅ Interactive Mode (Works)

bash

docker run -it <image_id>

Flags:

Result: