0

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;
TheVillageIdiot
  • 40,053
  • 20
  • 133
  • 188
  • Why do you do these things after installing the user? You were root just a moment ago; do these things before dropping your privileges. – tripleee Nov 27 '17 at 13:05
  • @tripleee I'll look at other question. And yes your second point is valid as well. But knowing how to overcome this is a good thing in itself. – TheVillageIdiot Nov 27 '17 at 20:16

0 Answers0