Prerequisite for this:
- Launch an EC2 Linux Instance on AWS. For more details click here
- Connect to an instance using Putty.
Install Docker on the EC2 Instance
- Update the installed packages and package cache on your instance by running the below command:
sudo yum update -y ( On linux instance apt-get doesn’t work , so you have to use the yum tool)
2. [ec2-user ~]$ sudo yum install -y docker
3. [ec2-user ~]$ sudo service docker start
Starting cgconfig service: [ OK ]
Starting docker: [ OK ]
4. Add the ec2-user
to the docker
group so you can execute Docker commands without using sudo
[ec2-user ~]$ sudo usermod -a -G docker ec2-user
5. docker info
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?
Docker is installed successfully. Isn’t it very easy to install docker ?