Problems depoying Openrouteservice to Azure using a container instance

221 Views Asked by At

I'm new to containers and I'm trying to deploy an instance in Azure using a Container Instance. I want to do it using 'docker compose up'. I have being trying to follow the documentation on how to do it but I'm stuck in the step after I created a docker context associated to my resource group in Azure and using it to run the command 'docker compose up' but nothing seems to happen. This is how my yml file looks like:

version: '2.4'
services:
  ors-app:
    container_name: ors-app
    ports:
      - "8080:8080"
      - "9001:9001"
    image: openrouteservice/openrouteservice:latest
    user: "${UID:-0}:${GID:-0}"
    build:
      context: ../
      args:
        ORS_CONFIG: ./openrouteservice/src/main/resources/ors-config-sample.json
        OSM_FILE: ./openrouteservice/src/main/files/heidelberg.osm.gz
    volumes:
      - mydata/graphs:/home/ors/ors-core/data/graphs
      - mydata/elevation_cache:/home/ors/ors-core/data/elevation_cache
      - mydata/logs/ors:/home/ors/ors-core/logs/ors
      - mydata/logs/tomcat:/home/ors/tomcat/logs
      - mydata/conf:/home/ors/ors-conf
      - mydata/puerto-rico-latest.osm.pbf:/home/ors/ors-core/data/osm_file.pbf
    environment:
      - BUILD_GRAPHS=True  # Forces the container to rebuild the graphs, e.g. when PBF is changed
      - "JAVA_OPTS=-Djava.awt.headless=true -server -XX:TargetSurvivorRatio=75 -XX:SurvivorRatio=64 -XX:MaxTenuringThreshold=3 -XX:+UseG1GC -XX:+ScavengeBeforeFullGC -XX:ParallelGCThreads=4 -Xms1g -Xmx2g"
      - "CATALINA_OPTS=-Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.port=9001 -Dcom.sun.management.jmxremote.rmi.port=9001 -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=false -Djava.rmi.server.hostname=localhost"

volumes:
  mydata:
    driver: azure_file
    driver_opts:
      share_name: orscontainersharename
      storage_account_name: orscontainerstorageacc

This is how the original yml file looks like before I made the changes:

version: '2.4'
services:
  ors-app:
    container_name: ors-app
    ports:
      - "8080:8080"
      - "9001:9001"
    image: openrouteservice/openrouteservice:latest
    user: "${UID:-0}:${GID:-0}"
    build:
      context: ../
      args:
        ORS_CONFIG: ./openrouteservice/src/main/resources/ors-config-sample.json
        OSM_FILE: ./openrouteservice/src/main/files/heidelberg.osm.gz
    volumes:
      - ./graphs:/home/ors/ors-core/data/graphs
      - ./elevation_cache:/home/ors/ors-core/data/elevation_cache
      - ./logs/ors:/home/ors/ors-core/logs/ors
      - ./logs/tomcat:/home/ors/tomcat/logs
      - ./conf:/home/ors/ors-conf
      - ./puerto-rico-latest.osm.pbf:/home/ors/ors-core/data/osm_file.pbf
    environment:
      - BUILD_GRAPHS=False  # Forces the container to rebuild the graphs, e.g. when PBF is changed
      - "JAVA_OPTS=-Djava.awt.headless=true -server -XX:TargetSurvivorRatio=75 -XX:SurvivorRatio=64 -XX:MaxTenuringThreshold=3 -XX:+UseG1GC -XX:+ScavengeBeforeFullGC -XX:ParallelGCThreads=4 -Xms1g -Xmx2g"
      - "CATALINA_OPTS=-Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.port=9001 -Dcom.sun.management.jmxremote.rmi.port=9001 -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=false -Djava.rmi.server.hostname=localhost"

I also have the image in Azure Container Registry.

1

There are 1 best solutions below

0
On

Q. I have being trying to follow the documentation on how to do it but I'm stuck in the step after I created a docker context associated to my resource group in Azure and using it to run the command 'docker compose up' but nothing seems to happen.

This is expected behavior when there is a syntax issues in the docker compose file.

In your case, I believe there is an issue with the volumes. When deploying docker containers to ACI instances, the volume do not accept binding folders in the azure fileshare as defined in your docker-compose.yml file.

    volumes:
      - mydata/graphs:/home/ors/ors-core/data/graphs

It should be as shown below.

    volumes:
      - mydata:/home/ors/ors-core/data/graphs

I have tried to reproduce the same issue and got confirmed with the below example. When I tried to deploy docker-compose.yml file with the volume referring to folder inside the azure file share as below, it does nothing. enter image description here

enter image description here

When trying to deploy docker-compose.yml file with volume as below, it is creating instance in ACI.

enter image description here

enter image description here