The only pre-requisite is that you have a valid Azure subscription.
Save the following to a text file named docker-compose.yml:
version: '3.1'services:wordpress:image: wordpress:5.8.2-php7.4-apacherestart: alwaysports:- 8888:80environment:WORDPRESS_DB_HOST: dbWORDPRESS_DB_USER: exampleuserWORDPRESS_DB_PASSWORD: examplepassWORDPRESS_DB_NAME: exampledbvolumes:- wordpress:/var/www/htmldb:image: mysql:8.0.0restart: alwaysenvironment:MYSQL_DATABASE: exampledbMYSQL_USER: exampleuserMYSQL_PASSWORD: examplepassMYSQL_RANDOM_ROOT_PASSWORD: '1'volumes:- db:/var/lib/mysqlvolumes:wordpress:db:
Login to https://portal.azure.com. Create a new app service as follows:
- Create a new resource group
- Provide a unique host name for your app's URL
- Select 'Docker Container" for Publish
- Select Linux for the Operating System
- Choose a data center closest to your city
Click on the "Next Docker" button.
- Select 'Docker Compose (Preview)' for Options.
- Select 'Docker Hub' for Image Source
- Select Public for Access Type
- Beside 'Configuration File', navigate to the docker-compose.yml and select it.
Click on the blue Create button. It may take some time to provision the containers. Upon completion, you will see a page that looks like this:
Click on the URL to view the WordPress page.
If something goes wrong and you wish to look into the console logs:
1) Enter 'log' into the filter
2) Turn "App Service Logs" ON
3) Click Save at the top
4) Click on "Log stream"
If you do not need these containers anymore, all you have to do to tear down everything is to delete the resource group.
It is painless to create a multi-container web application using docker-compose.yml.