Skip to main content

Command Palette

Search for a command to run...

Docker Installation In EC2

Docker

Published
1 min readView as Markdown

Update the packages on your instance

[ec2-user ~]$ sudo yum update -y

Install Docker

[ec2-user ~]$ sudo yum install docker -y

Start the Docker Service

[ec2-user ~]$ sudo service docker start

Add the ec2-user to the docker group so you can execute Docker commands without using sudo.(to overcome the permission denied)

[ec2-user ~]$ sudo usermod -a -G docker ec2-user

Create Docker Hub Account

Login to Docker Hub

docker pull <image-name>

e.g. docker pull mysql

docker images:to see the docker images

docker run -d -e MYSQL_ROOT_PASSWORD=test_123 mysql:latest-->create a container

docker run -d -e MYSQL_ROOT_PASSWORD=test_123 <images_name>:latest-->create a container

docker exec -it <cid> bash

bash4.4# mysql -u root -p

password: