0
votes

I have installed a lemp docker container w/ Ubuntu 16.04, Nginx, Mariadb, & PHP 7.0, and have set up postfix and basic ssh capabilities that all work fine. I have created a non-root user with sudo privileges (in the sudo group), but when I try to use sudo I get the error

sudo: no tty present and no askpass program specified

This happens for sudo, sudo -s, sudo su, etc.

I have gone into the /etc/sudoers file with visudo and added a line saying me ALL=(ALL) NOPASSWD: ALL since some other places suggested this, but it hasn't fixed the issue. Does anyone know a solution?

1
There's something wrong with your sudo config then as it's prompting for a password. Can you add your sudo config and the command you are trying to run? - Matt

1 Answers

0
votes

You need to launch the container with the tty enabled, docker run -it .... That said, installing a web server, db, mail server, and ssh, on a single container are very much an anti-pattern in the docker world. This is treating docker as a lightweight vm rather than an immutable single application isolation tool.