top of page

How to Deploy a Docker Container to Azure

Updated: Jan 29



How to install Azure CLI to Windows


Visit this site and install Azure CLI




After installation, close and reopen any active terminal window. Run the Azure CLI with the az command from either PowerShell or the Windows Command Prompt.



Now login to your Azure with Azure CLI


with command


AZ login

It will take you to one interactive window to login to your Azure account - use the email which is your primary email account for azure.


After Successful login you will get out put as follows




Now you can check your account details by using below command.


az account show

You will one Jason type structure. It means that you have successfully login


Steps to Deploy a Docker Container to Azure

Step 1: Create a Docker Container Locally

  1. Install Docker on your machine.

  2. Create a simple app (for example, Python Flask or Node.js).

  3. Create a Dockerfile:

# Example for Python Flask app
FROM python:3.11-slim
WORKDIR /app
COPY requirements.txt .
RUN pip install -r requirements.txt
COPY . .
EXPOSE 5000
CMD ["python", "app.py"]
  1. Build the image:

docker build -t myapp:1.0 .
  1. Test locally:

docker run -p 5000:5000 myapp:1.0

Step 2: Push Docker Image to Azure Container Registry (ACR)

  1. Search for “Container Registry”

    At the top search bar, type:

Container Registry

Click on Container Registries service.


Click + Create

You will see a Create button. Click it.



Fill the Basic Details

Field

What to select

Subscription

Azure for Students

Resource Group

Click Create new → name: myResourceGroup

Registry name

myacrstudent

Location

Central India (or nearest)




  1. Tag your image:


  1. Push image:


docker push myacrstudent.azurecr.io/myapp:1.0


Step go to Azure Portal and click to Create Resources and find web app




Fill these details




Click Review + Create and mark all the details



now click review and Create



After deployment you will find default domain name click it and you will find your container live on Azure cloud



$50

Product Title

Product Details goes here with the simple product description and more information can be seen by clicking the see more button. Product Details goes here with the simple product description and more information can be seen by clicking the see more button

$50

Product Title

Product Details goes here with the simple product description and more information can be seen by clicking the see more button. Product Details goes here with the simple product description and more information can be seen by clicking the see more button.

$50

Product Title

Product Details goes here with the simple product description and more information can be seen by clicking the see more button. Product Details goes here with the simple product description and more information can be seen by clicking the see more button.

Recommended Products For This Post
 
 
 

Comments


© 2023 by newittrendzzz.com 

  • Facebook
  • Twitter
  • Instagram
bottom of page