Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
688 views
in Technique[技术] by (71.8m points)

environment variables - Problem with accessing docker.sock when running Sudo –E docker

I have some problems running docker on a Debian (Stretch) VM hosted by our IT. I need to run dockerd as sudo, but under sudo I cannot access internet locations, because the VM admin set the option

  • env_reset = true

in /etc/sudoers which wipes the proxy settings.

So, if I run

$>sudo docker run hello-world

I get a timeout error because sudo cannot reach out to internet locations. If I run

$>export HTTP_PROXY=our_proxy
$>sudo -E docker run hello-world

I get an error message

docker: Cannot connect to the Docker daemon at unix:///home/myusername/.docker/run/docker.sock. Is the docker daemon running?. 

Obviously, the -E option somehow changes as well the path where docker looks for the file docker.sock - which resides at /run/

How can I get around this issue?

question from:https://stackoverflow.com/questions/65912959/problem-with-accessing-docker-sock-when-running-sudo-e-docker

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...