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.

python script

print my name

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

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

docker image name: test

docker run test outcome:
your name?: Traceback (most recent call last):
File “”, 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

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


If your python program is set to receive inputs from keyboard [Pre-requisite]. You can make an interactive container by setting a flag while running the container. Create docker files and image the same way. After building the image, tun the container as below:
Example below:
docker run -i yourContainerName