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

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


It seems the user you are using to access docker hub doesn't have enough permission. You can try adding prod-user to group Docker.

sudo usermod -a -G docker $USER

usermod is a command that modifies the system configuration for a specific user.

-a is a shortcut for --append: It means append the group to the list of groups the user belongs to.

-G is a shortcut for --groups: It tells usermod that the next argument is a group.

docker is the group we want to add $USER to.

$USER is the user that we want to modify.

If this alone doesn't resolve the issue then try below :

chmod 664 /var/run/docker.sock ## First try this.chmod 777 /var/run/docker.sock ## Then this. Not recommended though due to full permission.


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.