Reading variables from keyboard

Hello Folks.
I’m a linux/python/docker beginner.
I got stucked with reading python variables from keyboard while python script is running in docker.
Example:

python script test.py

print my name

name=input('your name?: ')
print('your name is: ', name)

Dockerfile
FROM python:latest
WORKDIR /home/jaceksiek/PycharmProjects/projekt1/venv
COPY . /home/jaceksiek/PycharmProjects/projekt1/venv
ENTRYPOINT [“python”, “test.py”]

docker image name: test

docker run test outcome:
your name?: Traceback (most recent call last):
File “test.py”, line 3, in
name=input('your name?: ')
EOFError: EOF when reading a line

I tried several methods with no success :frowning:

I’d appreciate your help.

Thank you in advance
Jacek

It funny to answer my own question :slight_smile:
-i is a solution

2 Likes