Skip to main content

Command Palette

Search for a command to run...

Docker Environment Setup on Local and AWS EC2

Published
3 min read
Docker Environment Setup on Local and AWS EC2

First, go to the official Docker website and create an account.

Link: (https://login.docker.com/u/login/identifier?state=hKFo2SBieEZWNDhMN3FBWHp3Y2ZQd19KN3F6Z3dXcFM3Z21YU6Fur3VuaXZlcnNhbC1sb2dpbqN0aWTZIGEtTWY2VXBicF83dDFEZGFrelBub2dCLUpMV2xqbEU0o2NpZNkgRmkyQ0VleDZtMzhkS1lxdnZaWVljSms5SUN0cGc3ZzQ)

After creating your account, download Docker Desktop.

Note: If you're on Windows, you’ll be asked to choose between amd64 or arm64 versions.
To check your system type:

  1. Go to This PCRight ClickProperties

  2. Look for System type

  3. If it says x64-based processor, then download the amd64 version.


☁️ How to Set Up Docker on AWS EC2

✅ Step 2: Open AWS and Create an Account

Visit the AWS Console and create a free-tier account.

👉 Link: AWS Console EC2 Region EU-North-1


🛠️ Step 3: Launch an EC2 Instance

Now go to the EC2 dashboard and start the process to launch a new instance.

  • Give your instance a name (e.g., docker-server)

  • Choose the Ubuntu OS (this is great for free-tier and Docker support)


🆓 Step 4: Select Instance Type

Choose t3.micro – it's available under the AWS free tier and perfect for practice.


🔑 Step 5: Create a Key Pair

You'll need to create a key pair (a .pem file) which contains your public and private key for SSH access.

  • Download and keep it safe – you’ll need it for connecting to your server.


💾 Step 6: Configure Storage

Set the storage size to 8 GB. This ensures your system won’t hang and Docker will run smoothly.


🚀 Step 7: Launch and Connect to the Instance

Click Launch Instance. After it’s launched, go to your EC2 dashboard and click Connect.


🔗 Step 8: Connect via SSH

You can now connect to your server using SSH. If you’re not familiar with this, follow the detailed SSH connection steps from this blog:
👉 (Insert your blog link here)
(ss)


🐳 Docker Installation on AWS EC2 (Ubuntu)

Now that you're connected to your instance via SSH, let’s install Docker.


🔄 Step 9: Update the Package List

Before installing Docker, update your package list to ensure all security patches are applied.

plaintextCopyEditsudo apt-get update


📦 Step 10: Install Docker

Now, install Docker using the following command:

plaintextCopyEditsudo apt-get install docker.io


✅ Step 11: Check Docker Status

Verify if Docker is running properly:

plaintextCopyEditsudo systemctl status docker

This command will also help you understand the Docker architecture and whether the service is active.


📋 Step 12: Check Docker Containers

To check running containers:

plaintextCopyEditdocker ps

Note: If you see a message saying that the current user is not part of the Docker group, you need to add yourself manually.

To add your user to the Docker group:

plaintextCopyEditsudo usermod -aG docker $USER

To apply the group change without logging out and back in:

plaintextCopyEditnewgrp docker