官术网_书友最值得收藏!

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:

  1. Clone the repository with the image source code and navigate to the Chapter03/04_iis-demo-index directory in PowerShell.

 

  1. 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 .
  1. 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.
  1. 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
  1. 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.

主站蜘蛛池模板: 桦南县| 大宁县| 丁青县| 敖汉旗| 平昌县| 长泰县| 商南县| 砀山县| 通城县| 靖远县| 安溪县| 昌都县| 阿拉善左旗| 桂阳县| 宝鸡市| 无锡市| 泰和县| 樟树市| 绩溪县| 桐乡市| 分宜县| 通化县| 清原| 清原| 泽普县| 阿克陶县| 鹤壁市| 连江县| 买车| 余庆县| 色达县| 长垣县| 克什克腾旗| 永安市| 庆城县| 江山市| 盐亭县| 临清市| 河东区| 南丰县| 浦县|