DEV Community

Karthi Mahadevan
Karthi Mahadevan

Posted on

Local OPA using docker

Docker Setup for OPA

Below is a Dockerfile to build and run OPA with your policies:


FROM openpolicyagent/opa:0.70.0 AS opa
USER 1005
COPY opa/policies /global

Build and Run the Docker Image

Build the Docker image:

docker build -t opa -f opa/Dockerfile .

Test the policies:

docker run -it --rm opa test -f pretty -v -b /global

Run the OPA server:

docker run -it --rm --name opa -p 8181:8181 opa run --server --ignore "*_test.rego" --addr :8181 -b /global

Top comments (0)