Install Docker On Ec2

  • I faced the same issue. My configuration is T4Large - ARM64 - Ubuntu Server 20.04 LTS and I resolved using the following command $ sudo apt install docker-compose This will install the 1.25.0 version of docker compose which is a bit older.
  • Deploying Docker containers on ECS. Estimated reading time: 21 minutes. The Docker Compose CLI enables developers to use native Docker commands to run applications in Amazon EC2 Container Service (ECS) when building cloud-native applications.
  • Oct 02, 2021 For full install instructions, see Docker basics for Amazon ECS. After launching the official Amazon Linux EC2 image, update the installed packages and install the most recent Docker CE packages: $. In this installation scenario, you’ll install Docker on a single Linux host, and then deploy Rancher on your host using a single Docker container.
  1. Install Docker Compose On Ec2
  2. Installing Docker On Ec2
  3. Install Docker On Ec2 Instance

To install Docker on an Amazon EC2 instance. Launch an instance with the Amazon Linux 2 or Amazon Linux AMI. For more information, see Launching an instance in the Amazon EC2 User Guide for Linux Instances. 2 Install Docker on Red Hat Enterprise Linux AWS EC2. 2.1 Step 1 – Check Linux version. 2.2 Step 2 – Update yum. 2.3 Step 3 – Add Docker Repository. 3 Step 4 – Install Docker Engine. 3.1 Step 5 – Enable Docker Service. 3.2 Step 6 – Start Docker. 3.3 Step 7- Verify Docker is Running.

This tutorial explains, how to install docker on EC2 Instance. Before starting, let’s have some brief knowledge about Docker.

Docker is a platform that combines applications and its dependencies in the form of packages, called container. We can run multiple containers on a single Operating System. Containers are not Virtual Machines. Virtual Machines requires Operating System to run applications, but containers do not. As containers don’t need an Operating System, it takes very little time to start and hence it is very faster than Virtual Machines.

Also Learn: How to install Ansible on Amazon Linux(EC2 )

and Launching Amazon Linux EC2 Instance

Let’s Install Docker on EC2 Instance

In this tutorial, we will use Amazon Linux to install docker. Amazon Linux/Amazon Linux2 is the Linux Operating System used in EC2 Instance.

Step 1– Log to Linux EC2 Instance and update it.

$ sudo yum update -y

Step 2– Install docker using Yum command

$ sudo yum install docker -y

Step 3– Start Docker Service

$ Service docker start

Step 4– Check docker Version.

$ docker -v

Basic Configuration (Creating Docker File / Running Docker Image)

Install Docker On Ec2

After you install docker on ec2 , let’s have some basic setup for Docker.

Step 1 – Create a docker file

Dockerfile is a text file where we write instructions to build an image.

Create a folder name Images on the Amazon Linux box.

$ mkdir images

Move to folder images

$ cd images

Create a file name Dockerfile inside images folder

$ nano Dockerfile

Put the content in the following way inside the Dockerfile.

FROM Ubuntu ( It will use the Official image Ubuntu to build your image)

MAINTAINER chandan <[email protected]>

( It sets the Author field of the generated image)

Install Docker Compose On Ec2

RUN apt-get update ( It will update the image at the time of Build)

CMD [ “echo”, ” Hello World ……….! “] ( It will run echo command when we run the docker container image)

Please also readHow to install docker on ec2 Instance(Windows)

You may also likeInstall Docker on Ubuntu using Script

Step 2– Run the docker build command to build the image.

$ docker build .

Note : ( . command is used when you are inside images folder where Dockerfile is present, alternatively you can put the docker file absolute path like /home/ec2-user/images/Dockerfile)

You can run the following command as well to Name and tag your Image. Here myimage is the Name and 01 is Tag of the image.

$ docker build -t myimage:01 .

Step 3– See the Docker Images after build

$ docker images

Step 4 – Run the docker image

$ docker run 07deaa33585e

Here 07deaa33585e is the IMAGE ID that can be seen in docker images command.

You can see here, it executed the echo command as soon as we run the docker image. In the same way, we can run any script, commands or any application by running a docker image.

Click to tweet this tip !

I hope you enjoyed this tutorial and learned to install docker on ec2 instance (Amazon Linux). If you think this is really helpful, please do share this with others as well. Please also share your valuable feedback, comment or any query in the comment box. I will really happy to resolve your all queries anytime.

Thank You

If you think we helped you or just want to support us, please consider these:-

Connect to us: FacebookTwitter

Ensure you are running Linux (kernel 3.8 or later) and have Docker(version 1.10.0 or later) installed.

Install Weave Net by running the following:

Install Weave Net by running the following: sudo curl -L git.io/weave -o /usr/local/bin/weave sudo chmod a+x /usr/local/bin/weave If you are on OSX and you are using Docker Machine ensure that a VM is running and configured before downloading Weave Net. We had this today with a fresh CoreOS 522.5.0 cluster (Docker 1.3.3 build 54d900a) on Amazon’s EC2. I am very unsure where the actual problem was. However it went away by reinstalling the cluster using the latest 522.6.0 AMIs.

If you are on OSX and you are using Docker Machine ensure that a VM is running and configured before downloading Weave Net. To set up a VM see the Docker Machinedocumentation or refer to “Part 1: Launching Weave Net with Docker Machine”.

After your VM is setup with Docker Machine, Weave Net can be launched directly from the OSX host. Weave Net respects the environment variable DOCKER_HOST, so that you can run and control a Weave Network locally on a remote host. See Using The Weave Docker API Proxy.

Install Docker On Ec2 Ubuntu 18.04

With Weave Net downloaded onto your VMs or hosts, you are ready to launch a Weave network and deploy apps onto it. See Launching Weave Net.

Quick Start Screencast


Docker Install On Ec2

Weave Net periodically contacts Weaveworks servers for availableversions. New versionsare announced in the log and in the statussummary.


The information sent in this check is:

  • Host UUID hash
  • Kernel version
  • Docker version
  • Weave Net version
  • Network mode, e.g. ‘awsvpc’

To disable this check, run the following before launching Weave Net:

Guides for Specific Platforms

Amazon ECS users see herefor the latest Weave AMIs.

If you’re on Amazon EC2, the standard installation instructions at thetop of this page, provide the simplest setup and the most flexibility.A special no-overlay mode for EC2 canoptionally be enabled, which allows containers to communicate at thefull speed of the underlying network.

Installing Docker On Ec2

To make encryption in fast datapath work on Google Cloud Platform, seehere.

Install Docker On Ec2 Instance

See Also

Most Viewed Posts