Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Unable to run Docker without sudo on AMI linux EC2 instance on AWS

I am unable to run Docker on AMI linux EC2 instance on AWS. My AMI linux instance is Linux ip-172-31-29-77 4.14.62-65.117.amzn1.x86_64 #1 SMP Fri Aug 10 20:03:52 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux.

I am able to install docker and start the service using:

sudo yum install -y docker
sudo service docker start
sudo usermod -aG docker ec2-user

but cmd docker ps does not work?

can anyone help me on this?

Thanks, Nidhi Arora

like image 998
Nidhi Arora Avatar asked Oct 25 '25 17:10

Nidhi Arora


1 Answers

You have done all the steps correctly. I believe your goal here is to run docker commands without sudo.

However after adding user to the docker (Or any) group, you have to refresh the user's group id.

You can either login again or do su - $USER.

You can run id before and after to confirm.

like image 61
Victor Wong Avatar answered Oct 27 '25 07:10

Victor Wong