/var/run/docker.sock: permission denied while running docker within Python CGI script

前端 未结 1 893
粉色の甜心
粉色の甜心 2021-02-14 14:19

I am trying to run Python CGI script inside which I need to run docker image. I am using Docker version 1.6.2. user is \"www-data\", which is added in docker group.



        
1条回答
  •  梦谈多话
    2021-02-14 14:32

    Permission denied on a default install indicates you are trying to access the socket from a user other than root or that is not in the docker group. You should be able to run:

    sudo usermod -a -G docker $username
    

    on your desired $username to add them to the group. You'll need to logout and back in for this to take effect (use newgrp docker in an existing shell, or restart the daemon if this is an external service accessing docker like your cgi scripts).

    Note that doing this effectively gives that user full root access on your host, so do this with care.

    0 讨论(0)
提交回复
热议问题