I am trying to access the docker image labels from Python as follows
hostname = socket.gethostname() cmd = "sudo curl --unix-socket /var/run/docker.sock http:/containers/" + hostname + "/json" output = os.popen(cmd).read()
But, the thing is I am getting the following error:
We trust you have received the usual lecture from the local System Administrator. It usually boils down to these three things: #1) Respect the privacy of others. #2) Think before you type. #3) With great power comes great responsibility. sudo: no tty present and no askpass program specified
It's one of the fancy messages by Unix from some other posts I read from StackOverflow.
I am following the below link
Only thing is I want to run these things from Python not from the Terminal. Also, FYI, I get the response when I run the same command from the terminal.
I tried appending the following piece in Dockerfile
RUN echo "root ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers