How to fix docker: Got permission denied issue

前端 未结 19 1155
醉话见心
醉话见心 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:43

    To fix that issue, I searched where is my docker and docker-compose installed. In my case, docker was installed in /usr/bin/docker and docker-compose was installed in /usr/local/bin/docker-compose path. Then, I write this in my terminal:

    To docker:

    sudo chmod +x /usr/bin/docker
    

    To docker-compose:

    sudo chmod +x /usr/local/bin/docker-compose
    

    Now I don't need write in my commands docker the word sudo

    /***********************************************************************/

    ERRATA:

    The best solution of this issue was commented by @mkasberg. I quote comment:

    That might work, you might run into issues down the road. Also, it's a security vulnerability. You'd be better off just adding yourself to the docker group, as the docs say. sudo groupadd docker, sudo usermod -aG docker $USER. Docs: https://docs.docker.com/install/linux/linux-postinstall/

    Thanks a lot!

提交回复
热议问题