- Hands-On Kubernetes on Windows
- Piotr Tylenda
- 266字
- 2021-06-24 16:54:05
Building a Docker image using Azure Container Registry
For demonstration purposes, we will use a simple Windows IIS image that hosts a static HTML web page. You can find the Docker image source in this book's GitHub repository: https://github.com/PacktPublishing/Hands-On-Kubernetes-on-Windows/tree/master/Chapter03/04_iis-demo-index. To build the image in ACR, follow these steps:
- Clone the repository with the image source code and navigate to the Chapter03/04_iis-demo-index directory in PowerShell.
- Execute the az acr build command in order to begin the Docker image build in the cloud environment (remember to provide the Docker build context directory, which in this example is denoted by the dot for the current directory):
az acr build `
--registry handsonkubernetesonwinregistry `
--platform windows `
--image iis-demo-index:latest .
- The az acr build command starts an ACR quick task. This uploads the Docker build context to the cloud and runs the build process remotely. After a few minutes, the build process should finish. You can expect output similar to the local docker build command.
- Now, you can verify the image by running a container on your local machine and pulling the image from ACR. You need to use the full DNS name for the registry (in this example, this is handsonkubernetesonwinregistry.azurecr.io):
docker run -it --rm `
-p 8080:80 `
handsonkubernetesonwinregistry.azurecr.io/iis-demo-index:latest
- Navigate to http://localhost:8080 in a web browser and verify that the container is running as expected:
You have successfully executed your ACR build quick task! Now, we can start automating the ACR build trigger for a GitHub repository code push in a similar fashion to how we would using Docker Hub.
推薦閱讀
- Mastering OpenLayers 3
- Extending Jenkins
- Vue.js 3.x快速入門
- 國(guó)際大學(xué)生程序設(shè)計(jì)競(jìng)賽中山大學(xué)內(nèi)部選拔真題解(二)
- Monkey Game Development:Beginner's Guide
- Mastering Entity Framework
- Java Web開發(fā)之道
- 從零開始學(xué)Linux編程
- Machine Learning in Java
- Building Serverless Web Applications
- ExtJS Web應(yīng)用程序開發(fā)指南第2版
- 人工智能算法(卷1):基礎(chǔ)算法
- 嵌入式Linux C語(yǔ)言程序設(shè)計(jì)基礎(chǔ)教程
- Visual Basic語(yǔ)言程序設(shè)計(jì)基礎(chǔ)(第3版)
- Java高手是怎樣煉成的:原理、方法與實(shí)踐