How to fix docker: Got permission denied issue

前端 未结 19 1138
醉话见心
醉话见心 2020-11-28 00:15

I installed Docker in my machine where I have Ubuntu OS. After than I installed docker, when I run

sudo docker run hello-world

All it\'s ok

19条回答
  •  暖寄归人
    2020-11-28 00:45

    After you installed docker, created 'docker' group and added user to it, edit docker service unit file:

    sudo nano /usr/lib/systemd/system/docker.service
    

    Add two lines into the section [Service]:

    SupplementaryGroups=docker    
    ExecStartPost=/bin/chmod 666 /var/run/docker.sock
    

    Save the file (Ctrl-X, y, Enter)

    Run and enable the Docker service:

    sudo systemctl daemon-reload
    sudo systemctl start docker
    sudo systemctl enable docker
    

提交回复
热议问题