Strider-CD / strider-docker-slave

Base docker image for running Strider jobs
4 stars 14 forks source link

Error : sudo: no tty present and no askpass program specified #5

Closed fernandoneto closed 9 years ago

fernandoneto commented 9 years ago

Hi,

I'm running strider-docker-slave, and all work great but in one of my repository i need to run a punch of commands from a MAKEFILE with sudo. He stops in the first command that have sudo. The error is this. sudo: no tty present and no askpass program specified any suggestions how to fix this? @niallo @jaredly

Best regards

kfatehi commented 9 years ago

you can setup a sudoers file with NOPASSWD for strider user and it shouldnt try to ask for a password interactively anymore as it will already be authorized

fernandoneto commented 9 years ago

@keyvanfatehi can you be more verbose please?

kfatehi commented 9 years ago

sure -- i'm saying that I think you can prevent the tty askpass stuff from happening (without having to remove sudo from your makefiles) by creating your own Docker image with sudoers correctly configured. e.g.:

sudoers.txt

root ALL=(ALL) ALL
strider ALL=(ALL) NOPASSWD: ALL
Defaults    env_reset
Defaults    secure_path="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"

Dockerfile

FROM strider/strider-docker-slave
USER root
ADD /sudoers.txt /etc/sudoers
RUN chmod 440 /etc/sudoers
USER strider
cusspvz commented 9 years ago

@keyvanfatehi Shouldn't this be a option of Strider-CD/strider-docker-runner ?

kfatehi commented 9 years ago

@cusspvz the image used by strider-docker-runner, https://github.com/Strider-CD/strider-docker-slave, is designed to provide the bare minimum of requirements to make the docker runner possible. users are to extend this image using Docker semantics (FROM strider/strider-docker-slave) and configure the strider-docker-runner to use that image instead.

Do you think this is something that should be in the base image? Perhaps -- but someone needs to test it and pull request if it's the right solution. Unfortunately I don't have a project right now that places me in that context.

@fernandoneto it would be nice to hear back from you to see what you ended up doing.

cusspvz commented 9 years ago

I understand your point.

If i was Project Manager on Strider i wouldn't put strider user as a sudoers on minimal slave, but i think that you could maintain images as runtime options for other users, perhaps we won't need it since we got our own stacked on top of strider/strider-docker-slave, but i think it is a great idea to supply resources for those who are trying Strider :)

cusspvz commented 9 years ago

By the way, @fernandoneto made a PR into our slave container findhit/strider-docker-findhit#1 .

Thank you for helping him :)

kfatehi commented 9 years ago

Yup we're working on making strider ecosystem more accessible in one of the PR's (plugin manager). Thanks, glad you guys got sorted out, enjoy Strider!