Install Docker Compose On Amazon Linux


How To Install Docker Compose On Amazon Linux AMI. By admin Last updated Jan 3, 2019. Create EC2 with Amazon Linux AMI; Install Docker over it, click. We will provide an example of how you can work with multiple containers, how to share volumes and how to deploy multiple containers locally suing the docker-compose and the Amazon Elastic Beanstalk’s multi container option.

An instance with an attached NVIDIA GPU, such as a P3 or G4dn instance, must have the appropriate NVIDIA driver installed. Depending on the instance type, you can either download a public NVIDIA driver, download a driver from Amazon S3 that is available only to AWS customers, or use an AMI with the driver pre-installed. Amazon Linux provides a stable, secure, and high-performance execution environment for applications. MySQL installation is not part of this tutorial. So if you also need MySQL server on your Amazon Linux, follow this tutorial. Step 1 – Initial Setup. Log in to your Amazon Linux 2 system via SSH. Its good to keep pacakges up to date, so execute the following command to update yum packages to latest: sudo yum update -y Step 2 – Install. With Amazon Linux 2, you get an application environment that offers long term support with access to the latest innovations in the Linux ecosystem. It is also available as a Docker container image and as a virtual machine image for use on Kernel-based Virtual Machine (KVM), Oracle VM VirtualBox, Microsoft Hyper-V, and VMware ESXi. For instance, the Bioconductor 3.0 release is available for R.3.1.x, so Bioconductor developers and leading-edge users need to be able to install the devel version of Bioconductor packages into the same version (though perhaps different instance or at least library location) of R that supports version 2.14 of Bioconductor.

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)

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

Install Docker Compose In Amazon Linux

Install Docker On Amazon Linux 2020

$ 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)

Install docker compose on amazon linux 2

MAINTAINER chandan <[email protected]>

( It sets the Author field of the generated image)

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)

Install Docker Compose On Amazon Linux Computer

Install Docker-compose On Amazon Linux 2

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.

Install Docker Compose On Amazon Linux

Ansible Install Docker Amazon Linux 2

$ 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

  • Most Viewed News

    • Download Epic Games Launcher For Mac
    • Utorrent Games Mac
    • Free Download El Capitan
    • Tensorflow Docker Windows
    • High Sierra 10.14 Download