When I was learning about Docker I was often told it's the best practice to run technologies in separate containers. For example, if I need nginx and php-fpm for my project, I should create a docker-compose.yml file and run two separate containers.
Now I'm learning about Azure App Services and I'm getting the impression it wants me to do the exact opposite.
If I have just one Dockerfile with php and nginx (without the Compose), it runs very well. Most importantly, CI/CD between Github repository and App Service can be set up with just a few clicks in Azure Portal.
If, however, I want to use docker-compose.yml and run php and nginx containers separately, I don't get the CI/CD with Github automatically. I can only setup CI/CD with Azure Container Registry. Also, it doesn't read the docker-compose.yml file from my repository automatically, I have to upload it in Azure Portal instead. It seems that Compose is only half-supported, with many inconveniences along the way.
Given how hard it seems to be to run docker-compose.yml on App Service, is it recommended to run a single Dockerfile instead?
On App Service, multi-container is currently in preview and so some features are not supported.
At this time, these are unsupported Docker Compose configuration options: build (not allowed), depends_on (ignored), networks (ignored), secrets (ignored), ports other than 80 and 8080 (ignored).
In order to use ACR with multi-container, all container images need to be hosted on the same ACR registry server.
Once they are on the same registry server, you will need to create application settings and then update the Docker Compose configuration file to include the ACR image name.
Create the following application settings:
• DOCKER_REGISTRY_SERVER_USERNAME
• DOCKER_REGISTRY_SERVER_URL (full URL, ex:https://<server-name>.azurecr.io)
• DOCKER_REGISTRY_SERVER_PASSWORD (enable admin access in ACR settings)
Within the configuration file, reference your ACR image like the following example:
image: <server-name>.azurecr.io/<image-name>:<tag>
See this doc configure-multi-container-apps and azure-container-registry--acr--to-use-with-multi-container for more details.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With