Source: /f/apachefriends/xampp/htdocs/PHP/docker-azure/php-app
Dockerize a PHP Application https://github.com/jerrodcodes/Youtube
tutorial: https://www.youtube.com/watch?v=1zWFxri51qQ
CLONE EXAMPLE REPORSITORY:$ git clone https://github.com/jerrodcodes/Youtube.git$ cd Dockerize-PHP-Application$ docker build -t mydemophpimage .$ docker image 
REPOSITORY                   TAG       IMAGE ID       CREATED         SIZE
mydemophpimage               latest    c73bd7947849   2 minutes ago   523MB$ docker-compose up -d 
ERROR: network test declared as external, but could not be found
SOLUTION:
//https://stackoverflow.com/questions/70307460/error-in-docker-network-path-declared-as-external-but-could-not-be-found$ docker network create "test"
TRY AGAIN:$ docker-compose up -d
ERROR:
Gracefully stopping... (press Ctrl+C again to force)
Error response from daemon: driver failed programming external connectivity on endpoint php-app-webserver-1 (4bea32f0f6f1b10e262ecefffec5b97122ffd9d7290ba9a4febe3637fc404826): Bind for 0.0.0.0:80 failed: port is already allocated
SOLUTION:
https://www.webune.com/forums/wapywm.html
Docker Command To Stop All Current Running Containers$ docker stop $(docker ps -a -q)
TRY AGAIN:$ docker-compose up -d
http://localhost
go inside to the container, GET THE NAME OF THE CONTAINER
# GET DOCKER ID:$ docker ps | grep mydemophpimage
0df0a44446de   mydemophpimage   "docker-php-entrypoi…"   2 hours ago   Up 27 minutes   0.0.0.0:80->80/tcp, 0.0.0.0:443->443/tcp   php-app-webserver-1
GO INSIDE THE DOCKER CONTAINERdocker exec -it php-app-webserver-1 bash# ls # cat index.php 
TO EDIT index.php, install nano 
$ su -
# apt-get update 
# apt-get install nano 
# nano index.php 
# exit 
TO RESTART CONTAINER:$ docker restart php-app-webserver-1
TO STOP CONTAINER:$ docker stop 
TO REMOVE CONTAINER:
$ docker cocntainer rm php-app-webserver-1
or
$ docker rm ID
create registry group:
https://portal.azure.com/#view/HubsExtension/BrowseResourceGroups
Resource Group: 
Region: East US
https://portal.azure.com/#create/Microsoft.ContainerRegistry
Select subscription.
Resource Group: Create if none  (resource202402091258pm)
registry name: mydemophpimage
NOTE: All lowercase only
location: East US
pricing plan: basic 
[Review + Create]
[Create]
RESOURCE: https://portal.azure.com/#@edwxxx5.onmicrosoft.com/resource/subscriptions/xxxxx/resourcegroups/resourceGroup20240209/providers/Microsoft.ContainerRegistry/registries/simpleAzureDockerPHP/overview
Copy and paste Login Server from this new resource:
example: simpleazuredockerphp.azurecr.io
From the resource, go to access keys 
Login Server: mydemxxxe.azurecr.io
[x] Admin User 
Username: mydemophpimage
pass: UVLMcIJmzxJ8S2W0hbgf12cTTEo8ZDss+WT5rF+r37+ACRDVLJ3S
pass2: CSqInJ3paPMyFYWSiPi4OIWuWifHl9aQWJyOw0dD6F+ACRC3Rb/s$ docker login mydemophpimage.azurecr.io
Username:
Password:
Login Succeeded$ docker images
REPOSITORY                   TAG       IMAGE ID       CREATED         SIZE
mydemophpimage               latest    c73bd7947849   3 hours ago     523MB
ADD TAG or else you might get error: An image does not exist locally with the tag: mydemophpimage.azurecr.io/mydemophpimage$ docker tag mydemophpimage mydemophpimage.azurecr.io/mydemophpimage:latest $ docker images
REPOSITORY                                 TAG       IMAGE ID       CREATED         SIZE
mydemophpimage                             latest    c73bd7947849   3 hours ago     523MB
mydemophpimage.azurecr.io/mydemophpimage   latest    c73bd794xx  3 hours ago     523MB
Push to azure:$ docker push mydemophpimage.azurecr.io/mydemophpimage:latest 
completed... 
go to repositories:
https://portal.azure.com/#@edwixxx5.onmicrosoft.com/resource/subscriptions/xxxx/resourcegroups/resourceGroup20240209/providers/Microsoft.ContainerRegistry/registries/simpleAzureDockerPHP/repository
Create container instance:
Create an Azure Container Instance using these settings:
Home > Create a Resource > 
https://portal.azure.com/#create/Microsoft.AppSvcLinux
Resource Group: Select from previous step 
Name: mydemophpimage
Public: Docker Container
OS Linux:
Region: EAST US
Linux Plan: leave as default 
Pricing Plan: Free f1 or Basic 
Zone redundancy: default: Disabled 
DOCKER TAB: 
    options: single
    Image Source: Azure Container Registry:
    Registry: mydemophpimage
    image: mydemophpimage
    tag: latest
Hit the create button
...Deployment is in progress
Wait for Your deployment is complete
go to resource: 
https://portal.azure.com/#@edwinxxx5.onmicrosoft.com/resource/subscriptions/xxxx/resourcegroups/resourceGroup20240209/providers/Microsoft.Web/sites/mydemophpimage/appServices
This will take about 1-10 minutes to create. After about 2 minutes, you can confirm your app by opening the URL in your browser:
https://mydemophpimage.azurewebsites.net/
Done