Install Ubuntu On Docker



  1. Oct 16, 2020 Install Docker Compose from Ubuntu's repository This is the easiest and recommend method. Unless you need the latest Docker Compose version for some specific reasons, you can manage very well with the docker compose version provides by Ubuntu.
  2. Mar 09, 2021 How to Install and Setup Docker on Ubuntu 18.04. Docker is an open-source technology that is used to deploy applications through containers.It is a relatively new platform but is constantly updated and features a wide community of users.
  3. May 21, 2020 This tutorial covers how to install Docker on an Ubuntu 20.04 machine. Docker is an open-source containerization platform that allows you to quickly build, test, and deploy applications as portable containers that can run virtually anywhere.

May 26, 2020 Before proceeding we need to install docker and docker-compose on our system: # apt-get install docker docker-compose The packages will be installed in few seconds, and the docker service will be automatically started. We can now proceed into creating a directory for our project and inside of it, another one to hold the pages that will be. Install Docker on Linux No matter your distribution of choice, you’ll need a 64-bit installation and a kernel at 3.10 or newer. Kernels older than 3.10 do not have the necessary features Docker requires to run containers; data loss and kernel panics occur frequently under certain conditions.

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

How To Install Ubuntu On Docker

$ 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

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

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

How To Install Ubuntu On Docker

$ 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

Install

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

Connect to us: Facebook | Twitter

Docker Compose is a Python program that lets you easily deploy multiple containers on a server.

Install Ubuntu 16.04 On Docker

As you start exploring Docker, you'll learn that often to run a certain web-app, you'll need to run various services (like database, web-server etc) in different containers.

DockerDocker

Deploying multiple containers is a lot easier with Docker Compose.

Ubuntu

In this tutorial, you'll learn two ways of installing Docker Compose on Ubuntu:

  • Installing Docker Compose from Ubuntu's repository: Easier method but may not have the latest version of docker compose
  • Installing the latest Docker Compose using PIP: Gets you the newer docker compose version

Keep in mind that to use Docker Compose, you must have Docker installed on Ubuntu.

Install Docker Compose from Ubuntu's repository

This is the easiest and recommend method. Unless you need the latest Docker Compose version for some specific reasons, you can manage very well with the docker compose version provides by Ubuntu.

Docker Compose is available in the universe repository of Ubuntu 20.04 and 18.04 so make sure to enable it first:

You probably won't need it but no harm in updating the local cache:

Now you can install Docker Compose in Ubuntu using this command:

You can check that Docker Compose is installed successfully by checking its version:

Install Ubuntu On Docker Container

It should show an output like this:

Install the latest Docker Compose on Ubuntu using PIP

PIP stands for 'PIP Installs Package'. It's a command-line based package manager for installing Python applications.

Since Docker Compose is basically a Python program, you can use PIP to install it.

But before you do that, you need to install PIP on Ubuntu first.

Enable the universe repository first.

Install PIP now:

Now that you have PIP installed use it to install Docker Compose for all users on your Linux system:

Check the Docker Compose version to ensure that it is installed successfully:

You can see that Docker Compose installed via PIP is more recent version.

Installation On Ubuntu Docker Docs

I hope you were able to successfully install Docker Compose on Ubuntu with this tutorial. Questions and suggestions are welcome.

Become a Member for FREE

Install Ubuntu Server On Docker

Become a member to get the regular Linux newsletter (2-4 times a month) and access member-only contents.

Join the conversation.