Search code examples
dockeramazon-ec2dockerhubamazon-linux

Permission denied when login to docker hub from AWS linux virtual machine


I'm using AWS Linux virtual machine as my production server. When I try to login to Docker-hub from AWS Linux virtual machine it says permission denied while trying to connect to the docker daemon socket. There are solutions in the internet and those need 'Sudo' access. But I just connect to the VM using SSH with user I created named prod-user. Therefor I don't have password.

click here tom see the error msg


Solution

  • I was able to fixed this with the help of @Pacifit answer. Since I cannot do any sudo things as prod-user what I did was I connect to the VM as ec2-user and then I added prod-user to the group by using

    sudo usermod -a -G docker prod-user
    

    and change the permission. Then I was able to execute docker in prod-user.