Skip to content

Reference plugin_authz implementation example #378

@benbooth493

Description

@benbooth493

I'm trying to write a custom plugin to use as plugin_authz but I keep getting the following message:

F1205 14:35:58.220673       1 main.go:254] Failed to load config: invalid config: bad plugin_authz config: error while loading authz plugin: plugin.Open("/plugin/authz.so"): Dynamic loading not supported

I am current using docker-compose to setup docker-registry v2 with docker_auth, and build my plugin.
I'm on M3 so as you can imagine there are a few factors involved in building the plugin correctly.

I could really benefit from a reference example of a plugin that satisfies the requirement necessary by docker_auth.
Along with this it would be lovely to have an example Dockerfile to reference for building this.

This is my current Dockerfile:

FROM golang:1.21-alpine3.18
WORKDIR /app
COPY go.mod ./
RUN apk add -U --no-cache gcc musl-dev file
RUN go mod download
COPY . .
ENV GOOS=linux
ENV GOARCH=amd64
ENV CGO_ENABLED=1
RUN go build -v -buildmode=plugin -o /build/authz.so ./...

In docker-compose I am mounting the resulting binary into docker_auth using a volume.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions