WordPress Docker Container Cannot Connect to Azure SQL Database

Expected behavior

Summary: Wordpress running from local Docker connecting to Azure SQL.

  1. I am following a guide: link
  2. I have built Ubuntu in Azure and installed Docker CE
  3. I cloned a GitHUb WordPress image (based on the guide)
  4. I built the image ‘Docker Build’
  5. I then ran the image and used the command suggested in the guide.
    sudo docker run --name test1 -e DB_ENV_HOST=M.mysql.database.azure.com:3306 -e DB_ENV_USER=@sql4cicdtest -e DB_ENV_PASSWORD= -e DB_ENV_NAME=wordpressprod -p 80:80 -d
  6. the image runs fine ‘Sudo Docker PS’

Actual behavior

  1. The image successfully loads in a container on the local Ubuntu server
  2. I can navigate to the website: http://sh-vm-docker.uksouth.cloudapp.azure.com/ (its live now if anyone wanted to check)
  3. It says " Error establishing a database connection"

Additional Information

I am able to verify that the Azure SQL database engine is listening by using a PowerShell command: Test-NetConnection .mysql.database.azure.com -port 3306

I suspect the string which sets the environment variables for WordPress is incorrect. I am VERY new to Docker and I am not a developer. Sorry for the basic / mistplaced nature of the question. I wasnt sure where was best to post a) on the site where the guide was written, b) on WordPress forums, c) on Azure forums or d) on here.

So this might be be so relevant, appologies in advance.

Steps to reproduce the behavior