I am trying to create a docker image from *Ubuntu 16.04 to run some python stuff. In the script I create a user with following command:
userad --create-home --gid sudo --shell /bin/bash testUser;\
echo 'testUser:superSecret007' | chpasswd;
This works fine. Next, I try to use this newly minted user account:
USER testUser
WORKDIR /home/testUser
Then when it this this line:
RUN sudo apt-get install -y libxml2;\
sudo pip install -r /home/testUser/requirements.txt;
It fails with following error:
Error : sudo: no tty present and no askpass program specified
Note that pip
is installed before creating user and also following runs successfully:
sudo pip install --upgrade pip;