Skip to content

Latest commit

 

History

History
129 lines (100 loc) · 5.44 KB

Demo4-running in ACI.md

File metadata and controls

129 lines (100 loc) · 5.44 KB
GitHub Sponsors Data Engineering with Enrique Catalá Data Engineering with Enrique Catalá LinkedIn Enrique Catalá Bañuls Twitter @enriquecatala Data Engineering: Canal youtube de Enrique Catalá

Runing image in Azure Container Instance

The docker version >2.3.2 lets you run your docker images on Azure Container Instances.

1) Publish your image to docker hub

Please follow the Demo3

2) Create an ACI context

Once you have the docker version >2.3.2, you will need to get started by logging into an Azure account using the Docker CLI:

# login to azure
docker login azure
# create the context
docker context create aci myaci
# List the new context
docker context list

3) Switch to the new ACI context

docker context use myaci

4) Run the container

To run container, you simply use the new sintax "docker compose"

NOTE: We are not using '-', the command is docker compose with a space in the midle

❯ docker compose -f .\docker-compose-demo4.yml up
[+] Running 2/2
 - Group mssqlserversamplesdb  Created                      5.3s
 - db1                         Done                         92.5s

NOTE: To check the status while deploying docker ps -a

❯ docker ps -a
CONTAINER ID               IMAGE                                              COMMAND             STATUS              PORTS
mssqlserversamplesdb_db1   enriquecatala/mssql-server-samplesdb:2019-latest                       Waiting             52.155.222.157:1433->1433/tcp

5) Check the status of the container

❯ docker ps
CONTAINER ID               IMAGE                                              STATUS              PORTS
mssqlserversamplesdb_db1   enriquecatala/mssql-server-samplesdb:2019-latest   Running             52.155.222.157:1433->1433/tcp

Check the logs

docker logs mssqlserversamplesdb_db1

❯ docker logs mssqlserversamplesdb_db1
*************************************************************************
Waiting for SQL Server to start (it will fail until port is opened)...
2020-09-28 22:00:55.24 Server      Microsoft SQL Server 2019 (RTM-CU4) (KB4548597) - 15.0.4033.1 (X64)
        Mar 14 2020 16:10:35
        Copyright (C) 2019 Microsoft Corporation
        Developer Edition (64-bit) on Linux (Ubuntu 18.04.4 LTS) <X64>
2020-09-28 22:00:55.24 Server      UTC adjustment: 0:00
2020-09-28 22:00:55.24 Server      (c) Microsoft Corporation.
2020-09-28 22:00:55.25 Server      All rights reserved.
2020-09-28 22:00:55.25 Server      Server process ID is 40.
2020-09-28 22:00:55.25 Server      Logging SQL Server messages in file '/var/opt/mssql/log/errorlog'.
2020-09-28 22:00:55.25 Server      Registry startup parameters:
         -d /var/opt/mssql/data/master.mdf
         -l /var/opt/mssql/data/mastlog.ldf
...

Apendix

Create new context

docker context create aci --help

List context

> docker context --help
❯ docker context list
NAME                TYPE                DESCRIPTION                               DOCKER ENDPOINT                  KUBERNETES ENDPOINT   ORCHESTRATOR
aci-context         aci                 mycontainerinstances@northeurope
default *           moby                Current DOCKER_HOST based configuration   npipe:////./pipe/docker_engine                         swarm

Stop the app

docker compose down

Delete old contexts

docker context rm aci-context