Issue with docker-compose and Azure app services

Mitesh Yadav 1 Reputation point
2021-08-12T00:35:06.657+00:00

I am using Azure App Services and docker-compose for my app deployment. Testing a simple job using Redis(Hosted as an Azure service) and Redis queue worker. Everything runs successfully on my local machine, but the job fails when I deploy it to App services using docker-compose. After debugging, I have found out the issue to be related to one of the docker-composes service not starting. Azure App services contain 3 tasks of: docker, build and push to ACR. The image gets successfully built and exported to ACR. Only one of the services ('web service') runs, which I believe is referencing the Dockerfile. The other service also uses the image, but is not running.

Build pipeline in App Services:

122502-image.png

Release pipeline in App Services:
122484-image.png

I've even changed the timeout options in the redis connection parameter for health checks and enabled retries on timeouts. Also, since App Services does not contain support for SSH in web-apps with multiple-containers, it's getting really hard for me to debug what exactly is the issue over here.

docker-compose.yml:

version: '3'
services:
web:
build: . #builds from dockerfile in current directory
image: acr_image
# container_name: web
command: python -u main.py
ports:
- "8000:8000" #mapping the port inside the container to your actual host. Same as in main.py
depends_on:
- worker
links:
- worker
networks:
- redisnet
worker:
build: .
image: acr_image
command: python -u worker.py
ports:
- "6380:6380"
networks:
- redisnet
networks:
redisnet:

worker.py:

redis1 = redis_conn_name

if name == 'main':
with Connection(redis1):
worker = Worker(map(Queue, listen))
worker.work()

Azure Cache for Redis
Azure Cache for Redis
An Azure service that provides access to a secure, dedicated Redis cache, managed by Microsoft.
251 questions
Azure App Service
Azure App Service
Azure App Service is a service used to create and deploy scalable, mission-critical web apps.
7,758 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Ryan Hill 28,106 Reputation points Microsoft Employee
    2021-08-16T13:24:01.87+00:00

    Hi @Mitesh Yadav ,

    Try removing the build docker option from your docker compose. It's not supported on custom container; see https://video2.skills-academy.com/en-us/azure/app-service/configure-custom-container?pivots=container-linux#docker-compose-options, and could be the source issue. I would also change the exposed port on the web image to - "8000:80".

    As for diagnosing, you can always enable logging on your web image and check the docker logs in the /LogFiles directory in Kudu. I would also try enabling SSH just on the web image and see if that works.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.