azuredockerdocker-composeazure-container-apps

Azure containerapp compose fails to run the container and generates no logs when provided with "entrypoint" or "command"


Having "entrypoint" or "command" fields in you docker-compose.yaml file causes azure container apps to crash upon creating the container.

I have a simple docker-compose.yaml file:

version: "3.9"
services:
  busybox:
    image: busybox
    container_name: busybox
    entrypoint: ["echo", "hello"]

Running this on docker works fine and echo's "hello".

But when I try to run the same container on Azure container apps via this command: az containerapp compose create --environment env --resource-group omd --compose-file-path docker-compose.yaml

The container crashes: failing container With no console logs.

Thanks


Solution

  • I tried using the YAML configuration and got the same error.
    You need to modify your YAML file to use sh or configure it to build as shown below:

      build:
          context: ./src
          dockerfile: ./TodoApi/Dockerfile 
    

    Use Docker image to build the specific code or components .

    Use this code as well from the docker-busybox-example repository for reference to build the image .

    From this documentation, you can use command: sh instead of entrypoint: ["echo", "hello"] to run Azure Container Apps.

    Check the sample code :

    version: '3'
    services:
      busybox:
        image: busybox
        command: sh -c "echo 'Hello from BusyBox!' && sleep 3600"
        stdin_open: true
        tty: true
    
    
    

    Running BusyBox as an HTTP Web Server with code :

    You can run a simple HTTP server in BusyBox to serve static files.

    version: '3'
    services:
      web:
        image: busybox
        command: httpd -f -p 8080
        volumes:
          - ./web-content:/www
        ports:
          - "8080:8080"
    

    For more detailed information, refer to BusyBox. enter image description here

    enter image description here