🌐
Tutorials Dojo
tutorialsdojo.com › home › aws › how to install docker on ubuntu using amazon ec2
How to Install Docker on Ubuntu using Amazon EC2
September 20, 2024 - Example: Ubuntu is often the go-to operating system for cloud-based virtual machines (like Amazon EC2) and is popular among developers for building and deploying software. Open the AWS Management Console, then search for EC2. Click Launch Instance.
🌐
Medium
medium.com › @srijaanaparthy › step-by-step-guide-to-install-docker-on-ubuntu-in-aws-a39746e5a63d
Step-by-Step Guide to Install Docker on Ubuntu in AWS | by Srija Anaparthy | Medium
February 3, 2023 - Here’s how to create and configure the VPC, as well as launch the EC2 instance within it. Check out the link below. ... Note: Instead of using an Amazon Linux machine, choose to launch an Ubuntu system because this blog will demonstrate the Docker installation part of an Ubuntu system.
Discussions

EC2 with docker services
Verdict: Both work well for Docker, ... if you're heavily relying on AWS services. 2. What would an initialization script (user data) be like to install Docker for both AMIs? For both Amazon Linux 2 and Ubuntu, you can add a user data script in the EC2 launch template to automate ... More on repost.aws
🌐 repost.aws
1
0
September 9, 2024
Docker on Ubuntu (AWS EC2) optimization/security
First, do not use SSH, block 22 (and RDP) ports on network ACL level entirely and use SSM session instead. Also be sure only to allow ports you need (80,443 for example) in EC2 instance security group. Installing and running Docker on Ubuntu is trivial once you get into it. There is obviously more things to be done if you want run this in production (SSL, load balancing, etc). I would also recommend to look into ECS Fargare or forgo EC2 entirely but that’s a bit too advanced. More on reddit.com
🌐 r/docker
9
10
September 12, 2025
Docker container on EC2
Sounds like you might not have Internet access for the VPC. I'm somewhat new to AWS and made a checklist for a recent project that handles this for me. Here is my checklist:: # Create a VPC # Create a subnet (optional: enable MapPublicIpOnLaunch) # Create a Security Group (must have both Inbound and outbound rules set) # Create an Internet Gateway # Attach Internet Gateway to the VPC # Create a public route table and associate it with the public subnet # Add a default route to the public route table that sends all internet-bound traffic through the Internet Gateway # Create EC2 Instance (optional: Enable AssociatePublicIpAddress here if the subnet is not enabled for public ip on launch) Would love to know if this helps you resolve the issues you're seeing. More on reddit.com
🌐 r/aws
11
1
May 1, 2024
Docker container and local host IP on EC2 (Ubuntu)?
host.docker.internal is working on Linux. You will have to add the entry inside the docker container using "add_hosts" option at "docker run" or inside your docker compose file. Explained here: https://medium.com/@TimvanBaarsen/how-to-connect-to-the-docker-host-from-inside-a-docker-container-112b4c71bc66 More on reddit.com
🌐 r/docker
1
0
September 5, 2024
🌐
LinuxShout
linux.how2shout.com › home › how to install docker on aws ec2 ubuntu 22.04 or 20.04 linux
How to install Docker on AWS EC2 Ubuntu 22.04 or 20.04 Linux
April 23, 2023 - Step-by-step guide for installing Docker on existing Ubuntu AWS Ec2 instance to create a virtual container for running various App Images.
🌐
Hashnode
sandhyaops.hashnode.dev › installing-docker-on-an-ec2-ubuntu-2204-instance
📥Installing Docker on an EC2 Ubuntu 22.04 Instance
September 18, 2024 - 🔑 Log in to AWS Console: Access your AWS Management Console and go to the EC2 Dashboard. ... Click "Launch Instance" and choose Ubuntu 24.04 LTS as the operating system. Select t2.micro as the instance type.
🌐
E-zest
blog.e-zest.com › install-docker-on-aws-ec2
Install Docker on AWS EC2 (Ubuntu 16.04)
So add a new user using this command: adduser docker Step 2: Add this user to the Sudoers Group visudo Step 3: Add the the line “root ALL=(ALL:ALL) ALL ”: docker ALL=(ALL:ALL) ALL Step 4: Switch to docker user sudo su docker Step 5: Add ...
🌐
GeeksforGeeks
geeksforgeeks.org › cloud computing › how-to-install-docker-on-aws-ec2
How To Install Docker On AWS EC2 ? - GeeksforGeeks
July 23, 2025 - Step 1: On the Dashboard of EC2, click on "Launch instance". Step 2: Put any name and choose AMI Image. Step 3: Choose the instance type , I have choosed t2.micro because it is free.
🌐
Medium
medium.com › @iampuredanger › how-to-install-docker-on-an-ubuntu-ec2-instance-in-aws-beginner-friendly-devops-guide-636e9e9b2239
How to Install Docker on an Ubuntu EC2 Instance in AWS (Beginner-Friendly DevOps Guide) | by Pure Danger | Medium
January 25, 2026 - Install Docker directly from Ubuntu’s official repositories. ... After installation, start the Docker service. ... Run Docker’s official test container to confirm everything is working. ... If the installation is successful, Docker will download a test image and display a confirmation message. Ensure Docker starts automatically whenever the EC2 instance restarts.
🌐
Bogotobogo
bogotobogo.com › DevOps › Docker › Docker_Install_On_EC2_Ubuntu.php
Docker install on EC2 Ubuntu 14.04 - 2016
Docker install on Amazon Linux AMI Docker install on EC2 Ubuntu 14.04 Docker container vs Virtual Machine Docker install on Ubuntu 14.04 Docker Hello World Application Nginx image - share/copy files, Dockerfile Working with Docker images : brief introduction Docker image and container via docker commands (search, pull, run, ps, restart, attach, and rm) More on docker run command (docker run -it, docker run --rm, etc.)
Find elsewhere
🌐
AWS re:Post
repost.aws › questions › QUcH0NvVJ_TQ282DssLg2AfQ › ec2-with-docker-services
EC2 with docker services | AWS re:Post
September 9, 2024 - 2. What would an initialization ... Amazon Linux 2 and Ubuntu, you can add a user data script in the EC2 launch template to automate the installation and setup of Docker and Docker Compose....
🌐
Medium
medium.com › @prabhathchathura › how-to-install-docker-docker-compose-on-aws-ec2-ubuntu-beginner-friendly-guide-2ed1962d14ad
How to Install Docker & Docker-Compose on AWS EC2 Ubuntu (Beginner-Friendly Guide) | by Prabhath Abeywickrama | Medium
May 25, 2025 - Once you’re connected to your server, run these commands one by one: # Update your server sudo apt update && sudo apt upgrade -y · # Install Docker sudo apt install docker.io -y # Start Docker and make it start automatically sudo systemctl ...
🌐
AWS
docs.aws.amazon.com › amazon ecs › developer guide › learn how to create and use amazon ecs resources › creating a container image for use on amazon ecs
Creating a container image for use on Amazon ECS - Amazon Elastic Container Service
2 weeks ago - If you don't have or need a local ... to launch an Amazon EC2 instance using Amazon Linux 2023 and install Docker Engine and the Docker CLI. Docker is available on many different operating systems, including most modern Linux distributions, like Ubuntu, and even macOS and ...
🌐
GitHub
gist.github.com › gonzaloplaza › ff79d0593085ed14b3a5c1ba2f8f7afa
Script to auto install Docker (last version) into AWS EC2/Ubuntu instance at launch time: User Data · GitHub
ubuntu@ip-10-0-3-119:~$ docker --version Command 'docker' not found, but can be installed with: sudo snap install docker # version 24.0.5, or sudo apt install podman-docker # version 4.9.3+ds1-1ubuntu0.1 sudo apt install docker.io # version ...
🌐
DevOps.dev
blog.devops.dev › install-docker-in-aws-ec2-19925ea29581
How to Install Docker in AWS EC2. This is the detailed tutorial on how to… | by Himanshu Yadav | DevOps.dev
February 6, 2025 - Press enter or click to view image in full size · Run the following command to ensure all packages are up to date: sudo apt-get update · Install the prerequisites for Docker: sudo apt-get install -y ca-certificates curl gnupg · Import Docker’s ...
🌐
Medium
medium.com › @selvigp › run-docker-on-ubuntu-linux-using-ec2-instances-b80ea00823b5
Run Docker on Ubuntu Linux using EC2 instances. | by Selvi Perumal | Medium
May 27, 2023 - In this blog, we are going to see how to create and run docker containers in ubuntu linux installed on top of EC2 instance. I am using…
Top answer
1 of 5
98

To get Docker running on the AWS AMI you should follow the steps below (these are all assuming you have ssh'd on to the EC2 instance).

  1. Update the packages on your instance

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

  2. Install Docker

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

  3. Start the Docker Service

    [ec2-user ~]$ sudo service docker start

  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

You should then be able to run all of the docker commands without requiring sudo. After running the 4th command I did need to logout and log back in for the change to take effect.

2 of 5
7

The hardest part to figure all of this out was the container-selinux requirement. Just find the latest version in http://mirror.centos.org/centos/7/extras/x86_64/Packages/ and install that first. In addition EC2 instances may not have a proper entropy generator so haveged may need to be installed.

The rest is taken from https://docs.docker.com/install/linux/docker-ce/centos/ with the addition of haveged and firewalld. All these have to be done as root so sudo appropriately.

yum install -q -y http://mirror.centos.org/centos/7/extras/x86_64/Packages/container-selinux-2.42-1.gitad8f0f7.el7.noarch.rpm
yum install -q -y http://dl.fedoraproject.org/pub/epel/7/x86_64/Packages/h/haveged-1.9.1-1.el7.x86_64.rpm
yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
yum install -q -y firewalld docker-ce
systemctl enable firewalld
systemctl start firewalld
firewall-cmd --add-port=2377/tcp --permanent
firewall-cmd --add-port=2376/tcp --permanent
firewall-cmd --add-port=7946/tcp --permanent
firewall-cmd --add-port=7946/udp --permanent
firewall-cmd --add-port=4789/udp --permanent
firewall-cmd --zone=public --permanent --add-masquerade
firewall-cmd --reload
systemctl enable haveged
systemctl start haveged
systemctl enable docker
systemctl start docker
setenforce 1

Enable SELinux by modifying /etc/sysconfig/selinux to be

SELINUX=enforcing
SELINUXTYPE=targeted

Then reboot your instance by issuing shutdown -r now

Executing sudo docker version should yield as of the time of this posting...

Client:
 Version:       18.03.0-ce
 API version:   1.37
 Go version:    go1.9.4
 Git commit:    0520e24
 Built: Wed Mar 21 23:09:15 2018
 OS/Arch:       linux/amd64
 Experimental:  false
 Orchestrator:  swarm

Server:
 Engine:
  Version:      18.03.0-ce
  API version:  1.37 (minimum version 1.12)
  Go version:   go1.9.4
  Git commit:   0520e24
  Built:        Wed Mar 21 23:13:03 2018
  OS/Arch:      linux/amd64
  Experimental: false
🌐
LinkedIn
linkedin.com › pulse › docker-installation-aws-ec2-instance-nandhini-saravanan
Docker Installation on AWS EC2 Instance
September 9, 2023 - sudo apt install -y apt-transport-https ca-certificates curl software-properties-common ... To ensure the authenticity of Docker packages, you should add Docker's GPG key to your system.
🌐
AWS
docs.aws.amazon.com › aws serverless application model › developer guide › aws sam reference › installing docker to use with the aws sam cli
Installing Docker to use with the AWS SAM CLI - AWS Serverless Application Model
Docker is available on many different ... and Ubuntu. For information about installing Docker on your particular operating system, see Get Docker ... Update the installed packages and package cache on your instance. ... Install the most recent Docker Community Edition package. ... Start the Docker service. ... Add the ec2-user to the ...
🌐
Medium
medium.com › @cjus › installing-docker-ce-on-an-aws-ec2-instance-running-ubuntu-16-04-f42fe7e80869
Installing Docker CE on an AWS EC2 instance running Ubuntu 16.04 | by Carlos Justiniano | Medium
August 6, 2018 - Installing Docker CE on an AWS EC2 instance running Ubuntu 16.04 In this post we’ll look at creating an EC2 instance running Ubuntu 16.04 and Docker CE (community edition). You might use such an …
🌐
nixCraft
cyberciti.biz › nixcraft › howto › amazon cloud computing › how to install docker on amazon linux 2
How to install Docker on Amazon Linux 2 - nixCraft
October 8, 2024 - This page explains how to install Docker and docker-compose on Amazon Linux 2 to containerized applications on AMI on EC2/Lightsail cloud.
🌐
Docker
docs.docker.com › manuals › docker engine › install › install docker engine on ubuntu
Install Docker Engine on Ubuntu | Docker Docs
April 23, 2026 - Before you install Docker Engine for the first time on a new host machine, you need to set up the Docker apt repository. Afterward, you can install and update Docker from the repository.