Skip to content

DRNJ Consultancy

DRNJ Consultancy

Month: October 2025

Azure Multi-Container YAML

21 October 2025

Background

As an exercise I had run WordPress via a Docker Compose file locally and then within Azure (I would not recommend this for “production” systems, this was merely an intellectual exercise and I based my ideas on this article amongst other.

Running containers within Azure is a little confusing for the beginner as, typical for Microsoft, there are many ways to do the same thing and I noted that it is possible to run multiple containers with a YAML file as opposed to a Docker Compose file.

So I created a YAML file which mirrored my Compose file and tried to run it

az container create --resource-group mygroup --dns-name-label myyaml  --file deploy-wp.yaml

With a YAML file:

apiVersion: 2021-09-01
location: uksouth
name: wordpress-group
type: Microsoft.ContainerInstance/containerGroups
properties:
containers:
- name: wordpress
properties:
image: wordpress:6.4
resources:
requests:
cpu: 1
memoryInGb: 1.5
ports:
- port: 80
environmentVariables:
- name: WORDPRESS_DB_HOST
value: db
- name: WORDPRESS_DB_USER
value: wordpressuser
- name: WORDPRESS_DB_PASSWORD
value: wordpresspass
- name: WORDPRESS_DB_NAME
value: wordpressdb
- name: mysql
properties:

image: mysql:8.0.27
resources:
requests:
cpu: 1
memoryInGb: 1.5
ports:
- port: 3306
- port: 33060
environmentVariables:
- name: MYSQL_ROOT_PASSWORD
value: rootpass
- name: MYSQL_DATABASE
value: wordpressdb
- name: MYSQL_USER
value: wordpressuser
- name: MYSQL_PASSWORD
value: wordpresspass
osType: Linux
ipAddress:
type: Public
dnsNameLabel: testwordpress
ports:
- protocol: tcp
port: 80
- protocol: tcp
port: 3306
- protocol: tcp
port: 33060

The containers started and I could read the logs via

az container logs –resource-group mygroup –name wordpress-group –container-name wordpress
az container logs –resource-group mygroup –name wordpress-group –container-name mysql

I could also get the FQDN of wordpress via

az container show --resource-group mygroup --name wordpress-group  --query "{FQDN:ipAddress.fqdn,ProvisioningState:provisioningState}" --out table

The Problem

I then browsed to the port 80 endpoint for the WordPress container (URL obtained from the Azure portal) and….Error….wordpress could not connect to the database

The Solution

After much head scratching and searching I found an article that suggested using 127.0.0.1 for the “db name” in the yaml file

          - name: WORDPRESS_DB_HOST
value: 127.0.0.1:3306
Azure, Docker, Uncategorised

Azure Error For ACI Container

21 October 2025

The Problem

I was trying to run a “simple” hello-world Azure Container Instance. When I typed

az container create --resource-group myrersourcegroup --name mytestcontainer --image "mcr.microsoft.com/azuredocs/aci-helloworld" --dns-name-label mydnslabel --ports 80 443

And it worked.

I tried it again a few days later and I got the error

(InternalServerError) Encountered an internal server error. The tracking activity id is 'ba9613c2-70b8-4e3c-8d51-51e603d1c2c6', correlation id is '7e07cd3a-6e34-4ff6-8dde-8be7e58a6262'.



What was going on?

The Solution

It turns out that this is a DNS label error. As I had copied/pasted the command I was using the DNS name “mydnslabel” and it looks like someone else was using the same label. Changing the DNS label to another name allowed the command and container to work

Azure, Docker Docker

Recent Posts

  • Azure Multi-Container YAML
  • Azure Error For ACI Container
  • AutoMapper and “Could not load type ‘SqlGuidCaster'” Error
  • OpenVPN on Docker and the Strange Error Message Saga
  • Docker CLI and Compose Information Message

Recent Comments

No comments to show.

Archives

  • October 2025
  • April 2025
  • December 2024
  • April 2024
  • September 2022
  • November 2021
  • June 2021
  • March 2021
  • July 2020
  • April 2020
  • November 2019
  • September 2019
  • July 2019
  • May 2019
  • February 2019
  • July 2018
  • June 2018

Categories

  • .NET Core
  • Azure
  • Docker
  • DotNet
  • Security
  • Uncategorised
  • Uncategorized
  • WebAPI
  • Windows

Idealist by NewMediaThemes