Docker is a very useful tool when it comes to create your applications, deploy and run them by using containers. In SDLC its utilization comes in the Deployment stage. Please follow the steps below to install and use Docker on your AWS EC2 machine.
- Launch an EC2 instance in your AWS account. Please remember the region you are launching the instance as the services of the tool installed will be available in this region only.
2. Connect to the SSH client where we can run the commands to configure Docker and use it.
Please follow the below steps to install docker on your AWS AMI machine.
3. Update the installed packages and package cache on your ec2 instance by running below command.
sudo yum update -y
4. Then to Install the latest Docker Community Edition package. Execute below command in your AWS Linux instance.
sudo amazon-linux-extras install docker or sudo yum install docker
5. To start the docker services execute the command below in your AWS Linux instance.
sudo service docker start
6. If you want to use the docker commands without using Sudo then Add the ec2-user to the docker group. Execute below command.
sudo usermod -a -G docker ec2-user
7. Now as docker is installed to use the Docker services, please once disconnect from your SSH client and connect again, to activate all the required Docker permissions.
8. To Verify If we can run the docker command without use of Sudo keyword, run the below command.
Now the Docker tool is ready to create Images and Containers. For more information on how to create Images and containers in Docker please refer our article “To create images and containers using Docker on AWS”.