Install Docker on Azure Virtual Machine — Github -> Docker Hub -> Azure Deploy Pipeline Part 1

Hasan Şahin
HardwareAndro
Published in
3 min readFeb 19, 2021

Introduction

Docker is an application that makes it simple and easy to run application processes in a container, which are like virtual machines, more portable, more resource-friendly, and more independent on the host operating system.

We will make our own CI/CD pipeline in this blog series. The work will do is in blog series;

Part 1 : Create Virtual Machine on Azure Portal and Install Docker

Part 2 : .Net Project and Docker File

Part 3 : Github Actions: Auto Test After Push Branch

Part 4 : Github Actions: Auto Publish to Docker Hub and Deploy Azure (SSH)

In short, when we push to Github, the new version of our application will be deployed on our server.

Create Azure Virtual Machine

After opening our membership through the Azure portal, We choose the ‘Virtual machines’ option

On the page that opens, click on the ‘Add’ tab on the left side. By clicking ‘Virtual Machine’ in the incoming window then go to the settings page to create our virtual machine.

On this page, you will see the features of the virtual computer you want to create and the fee you want to pay accordingly. Customize it for yourself. Here, I prefer the username and password instead of the ssh key for connecting to the server.

Here I create the server by pressing the ‘Review + create’ button directly. You can continue to customize.

After the server installation is complete, you will see its Public IP address. Connect to the server terminal via this rope. For that, I prefer the PuTTy program.

Connect Virtual Machine Console — Putty

Docker Installation

We have successfully logged in. Now start the Docker installation. Firstly, update our package manager with sudo apt-get update.

Check Docker documentation for more information and installation.

Type in the command line step by step.

sudo apt-get install \
apt-transport-https \
ca-certificates \
curl \
gnupg-agent \
software-properties-common
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -sudo apt-key fingerprint 0EBFCD88sudo add-apt-repository \
"deb [arch=amd64] https://download.docker.com/linux/ubuntu \
$(lsb_release -cs) \
stable"
sudo apt-get install docker-ce docker-ce-cli containerd.io

When the installation is complete, test it by typing docker versionor sudo docker run hello-world .

Congratulations. You’re ready to enter the Docker world.

Part 2 :With Part 2, we will see how to create a Docker file compatible with Net Core and Test Project.

Part 2 : https://hasansahinn.medium.com/docker-file-and-net-core-project-github-docker-hub-azure-deploy-pipeline-part-2-4526bc02581d

Part 3 : https://hasansahinn.medium.com/github-actions-auto-test-github-docker-hub-azure-deploy-pipeline-part-3-105d9002acae

Part 4: https://hasansahinn.medium.com/publishing-in-dockerhub-and-azure-github-docker-hub-azure-deploy-pipeline-part-4-d6efde5aca1e

--

--