다음을 통해 공유


Azure Container reqistry : How to create an SQL Server on Linux container image using Docker file

Introduction

The Azure container registry can store private Docker container images, and by deploying with the Azure container registry service hierarchy " Premium ", you can manage one registry across multiple regions, use Azure private links, etc. , It is possible to create a configuration that is conscious of a high availability configuration (large-scale configuration) that spans regions, such as being able to access the container image only by private communication without exposing it to the Internet network.

In this article, I'd like to show you how to use Docker file in the Azure container registry to create a custom SQL Server on Linux container image.

  1. 1. Deploy Azure container registry
  2. 2. Creating a SQL Server on Linux container image using Dockerfile
  3. 3. Summary

Deploy Azure container registry

1) From the Azure portal, select "Container Registry" and then "Create Container Registry".

  1. 2) Select "Library Name", "Area", and "SKU", at that point select "Next: Network".
    • [Supplement]
    • SKU: By selecting " Premium ", you can manage one registry between multiple regions, or you can access the container image only by private communication without exposing it to the Internet network using Azure private link etc. Is possible.
  2. 3) Select "Association Method" and afterward "Affirm and Create".

Supplement

Select Private Endpoint if you only need to access the container image via private communication .

 

4) After confirming the entered information, select "Create" to create the container registry. 

Creating a SQL Server on Linux container image using Dockerfile

  1. 1) From the publicly available SQL Server on Linux container images, select the image you want to customize and place in the Azure container registry.
    • -A container image with SQL Server on Linux installed on Redhat is published as a catalog by Redhat.
    • -A container image with SQL Server on Linux installed on Ubuntu is available from Microsoft.
  2. 2) Launch the Azure Cloud Shell from the Azure portal.
  3. 3) Select "Bash".
  4. 4) Execute the " code. " Command to start the editor.
    • * This time, the mkdir command was used to create the " docker " directory, so the cd command is used to move the current directory path to the " docker " directory.
  5. 5) After entering the following in the editor, save it as " Dockerfile " and close the editor.

 

Dockerfile

FROM mcr.microsoft.com/mssql/server:2019-latest

* If you want to use the published Ubuntu + latest SQL Server 2019 container image, specify "mcr.microsoft.com/mssql/server:2019-latest" in the FROM clause.

* This time, the mkdir command was used to create the " docker " directory, so the cd command is used to move the current directory path to the " docker " directory.

 

5) After entering the following in the editor, save it as " Dockerfile " and close the editor.

 

Docker file

FROM mcr.microsoft.com/mssql/server:2019-latest

* If you want to use the published Ubuntu + latest SQL Server 2019 container image, specify "mcr.microsoft.com/mssql/server:2019-latest" in the FROM clause.

6) Create a container image using Dockerfile with the "az acr build" command.

az acr build --image <repository name>: <tag name> --registry <Azure container registry name> --file Dockerfile .. 

[Command example] 

az acr build --image sqlonlinux: v1 --registry arcje01 --file Dockerfile .. 

Summary

This time, I showed you how to create a SQL Server on Linux container custom image using Dockerfile in the Azure container registry.

By storing the container image in the Azure container registry, you can easily deploy the container image with Azure Kubernetes Service (AKS) or, and by customizing the image in advance, until the container image is deployed. I think it is possible to shorten the time.

Next time , I'll summarize how to deploy the container image created this time to Azure Kubernetes Service (AKS)  .