Search code examples
azuredockerazure-web-app-serviceopen-policy-agent

Has anyone installed OPA (open policy agent) Docker Container in Azure App Services?


Has anyone installed 'openpolicyagent/opa' as a docker image deployment in Azure App Service successfully? If yes can you please share how you did this? I attempted to do this with the startup command 'docker run -it --rm -p 8181:8181 openpolicyagent/opa run --server --addr :8181' and without a startup command.

Both effectively produce the same error which is the site fails to start...

/home/LogFiles/2022_03_10_pl0sdlwk00001X_docker.log
2022-03-10T22:39:28.658Z INFO - Pull Image successful, Time taken: 0 Minutes and 0 Seconds 2022-03-10T22:39:28.668Z INFO - Starting container for site 2022-03-10T22:39:28.669Z INFO - docker run -d -p 80:80 --name opa-policy-server_0_51a5bbcf -e WEBSITES_ENABLE_APP_SERVICE_STORAGE=false -e WEBSITE_SITE_NAME=opa-policy-server -e WEBSITE_AUTH_ENABLED=False -e PORT=80 -e WEBSITE_ROLE_INSTANCE_ID=0 -e WEBSITE_HOSTNAME= -e WEBSITE_INSTANCE_ID=f6284c65c14198cd70b55d3c9c413d8fa5047ec06e41a24daf1e4ba58ad6479f openpolicyagent/opa:latest

2022-03-10T22:39:28.670Z INFO - Logging is not enabled for this container. Please use https://aka.ms/linux-diagnostics to enable logging to see container logs here. 2022-03-10T22:39:31.463Z INFO - Initiating warmup request to container dd-opa-policy-server_0_51a5bbcf for site opa-policy-server 2022-03-10T22:39:31.477Z ERROR - Container dd-opa-policy-server_0_51a5bbcf for site opa-policy-server has exited, failing site start 2022-03-10T22:39:31.483Z ERROR - Container dd-opa-policy-server_0_51a5bbcf didn't respond to HTTP pings on port: 80, failing site start. See container logs for debugging. 2022-03-10T22:39:31.487Z INFO - Stopping site opa-policy-server because it failed during startup.


Solution

  • When creating the App Service, in the Docker tab, use the following settings:

    • Image and tag: openpolicyagent/opa
    • Startup command: run --server --addr:80

    enter image description here

    If you want to use a port different than the default port 80, lets say 8181, make sure to add this application setting:

    WEBSITES_PORT: 8181