Home > Net >  Adding ec2-user to docker group
Adding ec2-user to docker group

Time:05-25

I want to install docker on my ec2 instance.

sudo yum install docker -y

I came to know that this command automatically creates a group 'docker' which has root privileges by default.so I add my ec2-user to this group to execute commands without 'sudo'.

sudo usermod -aG docker ec2-user

Now this means ec2-user has root privileges But if I want to start the docker service,why should I use

sudo systemctl start docker

instead of simply

systemctl start docker

Above command is giving me an error:

Failed to start docker.service: The name org.freedesktop.PolicyKit1 was not provided by any .service files See system logs and 'systemctl status docker.service' for details.

Please help!

CodePudding user response:

because docker is system service so you must use sudo or run it without sudo as root user or you can use

sudo systemctl enable docker

and after every reboot docker service will be running automatically

  • Related