The docker version >2.3.2 lets you run your docker images on Azure Container Instances.
- Runing image in Azure Container Instance
- 1) Publish your image to docker hub
- 2) Create an ACI context
- 3) Switch to the new ACI context
- 4) Run the container
- 5) Check the status of the container
- Apendix
Please follow the Demo3
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
docker context use myaci
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
❯ docker ps
CONTAINER ID IMAGE STATUS PORTS
mssqlserversamplesdb_db1 enriquecatala/mssql-server-samplesdb:2019-latest Running 52.155.222.157:1433->1433/tcp
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
...
docker context create aci --help
> 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
docker compose down
docker context rm aci-context