Digital Marketing

Installing Docker on Amazon Linux 2

Update the installed packages and package cache on your instance.

sudo yum update -y
Install the most recent Docker Community Edition package.

sudo amazon-linux-extras install docker
Start the Docker service.

sudo service docker start
Add the ec2-user to the docker group so you can execute Docker commands without using sudo.

sudo usermod -a -G docker ec2-user
Log out and log back in again to pick up the new docker group permissions. You can accomplish this by closing your current SSH terminal window and reconnecting to your instance in a new one. Your new SSH session will have the appropriate docker group permissions.

Verify that the ec2-user can run Docker commands without sudo.

docker ps
You should see the following output, showing Docker is installed and running:

 
 CONTAINER ID        IMAGE               COMMAND             CREATED             STATUS              PORTS               NAMES
               
Note
In some cases, you may need to reboot your instance to provide permissions for the ec2-user to access the Docker daemon. Try rebooting your instance if you see the following error:

Cannot connect to the Docker daemon. Is the docker daemon running on this host?

Comments

Popular posts from this blog

Make online money from the Internet