April 27, 2020 / Nirav Shah
<h2><strong>What is Docker ?</strong></h2>
<ul class=”listing”>
<li>Docker is basically a container engine which uses the Linux Kernel features like namespaces and control groups to create containers on top of an operating system and automates application deployment on the container. Docker uses Copy-on-write union file system for its backend storage</li>
</ul>
<h2><strong>Prerequisites</strong></h2>
<ul class=”listing”>
<li>One Ubuntu 18.04 server</li>
<li>An account on Docker Hub if you wish to create your own images and push them to Docker Hub</li>
</ul>
<h2><strong>Install Docker in the ubuntu server</strong></h2>
<ul class=”listing”>
<li>
<h3><strong>Step 1: Update Software Repositories</strong></h3>
<ul class=”listcircle”>
<li>It’s a smart thought to refresh the neighborhood database of programming to ensure you have access to the most recent updates.</li>
<li>Open a terminal window and type:</li>
</ul>
</li>
</ul>
<pre>$ sudo apt-get update</pre>
<ul class=”listing”>
<li>
<h3><strong>Step 2: Uninstall Old Versions of Docker</strong></h3>
<ul class=”listcircle”>
<li>Next, it’s prescribed to uninstall any old Docker programming before continuing.</li>
<li>Utilize the order:</li>
</ul>
</li>
</ul>
<pre>$ sudo apt-get remove docker docker-engine docker.io</pre>
<ul class=”listing”>
<li>
<h3><strong>Step 3: Install Docker</strong></h3>
<ul class=”listcircle”>
<li>To install Docker on Ubuntu, in the terminal window enter the command:</li>
</ul>
</li>
</ul>
<pre>$ sudo apt install docker.io</pre>
<ul class=”listing”>
<li>
<h3><strong>Step 4: Start and Automate Docker</strong></h3>
<ul class=”listcircle”>
<li>The Docker administration should be arranged to run at startup. To do as such, type in each order followed by enter:</li>
</ul>
</li>
</ul>
<pre>$ sudo systemctl start docker</pre>
<pre>$ sudo systemctl enable docker</pre>
<img class=”img-responsive” src=”https://www.eternalsoftsolutions.com/blog/wp-content/uploads/2020/04/install-docker4.png” />
<ul class=”listing”>
<li>
<h3><strong>Step 5 (Optional): Check Docker Version</strong></h3>
<ul class=”listcircle”>
<li>To verify the installed Docker version number, enter:</li>
</ul>
</li>
</ul>
<pre>$ docker –version</pre>
<img class=”img-responsive” src=”https://www.eternalsoftsolutions.com/blog/wp-content/uploads/2020/04/install-docker5.png” />
<h2><strong>Alternative: Install Docker from Official Repository</strong></h2>
<ul class=”listing”>
<li>
<h3><strong>Step 1: Update Local Database</strong></h3>
<ul class=”listcircle”>
<li>It’s a smart thought to refresh the neighborhood database of programming to ensure you have access to the most recent updates.</li>
<li>Open a terminal window and type:</li>
</ul>
</li>
</ul>
<pre>$ sudo apt-get update</pre>
<ul class=”listing”>
<li>
<h3><strong>Step 2: Download Dependencies</strong></h3>
<ul class=”listcircle”>
<li>You’ll have to run these orders to permit your working framework to get to the Docker stores over HTTPS.</li>
<li>In the terminal window, type:</li>
</ul>
</li>
</ul>
<pre>$ sudo apt-get install apt-transport-https ca-certificates curl software-properties-common</pre>
<ul class=”listing”>
<li style=”list-style-type: none;”>
<ul class=”listcircle”>
<li>To clarify, here’s a brief breakdown of each command:
<ul class=”square”>
<li>apt-transport-https: Allows the package manager to transfer files and data over https</li>
<li>ca-certificates: Allows the system (and web browser) to check security certificates</li>
<li>curl: This is a tool for transferring data</li>
<li>software-properties-common: Adds scripts for managing software</li>
</ul>
</li>
</ul>
</li>
</ul>
<ul class=”listing”>
<li>
<h3><strong>Step 3: Add Docker’s GPG Key</strong></h3>
<ul class=”listcircle”>
<li>The GPG key is a security feature.</li>
<li>To ensure that the software you’re installing is authentic, enter:</li>
</ul>
</li>
</ul>
<pre>$ curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add –</pre>
<img class=”img-responsive” src=”https://www.eternalsoftsolutions.com/blog/wp-content/uploads/2020/04/install-docker3.png” />
<ul class=”listing”>
<li>
<h3><strong>Step 4: Install the Docker Repository</strong></h3>
<ul class=”listcircle”>
<li>To install the Docker repository, enter the command:</li>
</ul>
</li>
</ul>
<pre>$ sudo add-apt-repository “deb [arch=amd64]</pre>
https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable”
<img class=”img-responsive” src=”https://www.eternalsoftsolutions.com/blog/wp-content/uploads/2020/04/install-docker2.png” />
<strong>Increasing space in the linux server </strong>
<ul class=”listing”>
<li>
<h3><strong>Step 5: Update Repositories</strong></h3>
<ul class=”listcircle”>
<li>Update the repositories you just added:</li>
</ul>
</li>
</ul>
<pre>$ sudo apt-get update</pre>
<ul class=”listing”>
<li>
<h3><strong>Step 6: Install Latest Version of Docker</strong></h3>
<ul class=”listcircle”>
<li>To install the latest version of docker:</li>
</ul>
</li>
</ul>
<pre>$ sudo apt-get install docker-ce</pre>
<ul class=”listing”>
<li>
<h3><strong>Step 7 (Optional): Install Specific Version of Docker</strong></h3>
<ul class=”listcircle”>
<li>List the available versions of Docker by entering the following in a terminal window:</li>
</ul>
</li>
</ul>
<pre>$ apt-cache madison docker-ce</pre>
<img class=”img-responsive” src=”https://www.eternalsoftsolutions.com/blog/wp-content/uploads/2020/04/install-docker1.png” />
<ul class=”listing”>
<li style=”list-style-type: none;”>
<ul class=”listcircle”>
<li>The system should return a list of available versions</li>
<li>At this point, type the command:</li>
</ul>
</li>
</ul>
<pre>$ sudo apt-get install docker-ce=</pre>
<img class=”img-responsive” src=”https://www.eternalsoftsolutions.com/blog/wp-content/uploads/2020/04/install-docker3.png” />
<ul class=”listing”>
<li>
<h3><strong>Step 8 (Optional): Check Docker Version</strong></h3>
<ul class=”listcircle”>
<li>To verify the installed Docker version number, enter:</li>
</ul>
</li>
</ul>
<pre>$ docker –version</pre>
<strong>Also Read:</strong>
<a href=”https://www.eternalsoftsolutions.com/blog/everything-you-need-to-know-about-docker-on-amazon-ecs/” target=”_blank” rel=”noopener”><span style=”font-weight: 400;”> Everything you Need to Know About Docker on Amazon ECS</span></a>
<a href=”https://www.eternalsoftsolutions.com/blog/how-to-install-wordpress-in-docker-container/” target=”_blank” rel=”noopener”><span style=”font-weight: 400;”>How To Install WordPress In Docker Container</span></a>

Nirav Shah is the Director of Eternal Web Pvt Ltd, an AWS Advanced Consulting Partner and certified Odoo Partner based in the UK. With over a decade of experience in cloud computing, digital transformation, and ERP implementation, Nirav helps enterprises adopt the right technology to solve complex business challenges. He specialises in AWS infrastructure, Odoo ERP, and web development solutions for businesses across the UK and beyond.
Have queries about your project idea or concept? Please drop in your project details to discuss with our AWS Global Cloud Infrastructure service specialists and consultants.