# moby/profiles architecture

> Architecture diagram of the GitHub repository moby/profiles, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-24). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/moby/profiles
- Repository: https://github.com/moby/profiles

## Overview

Profiles is a Go library collection for container security: callers request AppArmor or seccomp profiles, which are generated or adapted into runtime-ready policy. AppArmor’s sampled install path renders a profile and loads it through apparmor_parser; seccomp exposes default and JSON-loaded profile paths, with conditional rules evaluated against host architecture, capabilities, and kernel version. The README also documents both packages as independently usable. Unsampled seccomp details are represented only at the subsystem level; edges are limited to relationships shown in excerpts or the README.

Main entry points: [`seccomp/seccomp_linux.go`](https://github.com/moby/profiles/blob/main/seccomp/seccomp_linux.go) (Profile loading), [`apparmor/apparmor.go`](https://github.com/moby/profiles/blob/main/apparmor/apparmor.go) (Profile install), [`apparmor/template.go`](https://github.com/moby/profiles/blob/main/apparmor/template.go) (Profile renderer), [`seccomp/seccomp.go`](https://github.com/moby/profiles/blob/main/seccomp/seccomp.go) (Profile schema)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_apparmor["AppArmor profiles"]
  node_aa_runtime["Profile install<br/>[apparmor.go]"]
  node_aa_renderer["Profile renderer<br/>[template.go]"]
end

subgraph group_seccomp_api["Seccomp profile API"]
  node_seccomp_entry["Profile loading<br/>[seccomp_linux.go]"]
  node_seccomp_types["Profile schema<br/>[seccomp.go]"]
end

subgraph group_seccomp_policy["Seccomp policy"]
  node_default_policy["Default syscall policy<br/>[default_linux.go]"]
  node_kernel_check["Kernel version check<br/>[kernel_linux.go]"]
end

node_callers(("Package callers"))
node_apparmor_parser["apparmor_parser"]

node_callers -->|"requests install"| node_aa_runtime
node_aa_runtime -->|"renders profile"| node_aa_renderer
node_aa_runtime -->|"loads profile"| node_apparmor_parser
node_callers -->|"requests profile"| node_seccomp_entry
node_seccomp_entry -->|"decodes JSON"| node_seccomp_types
node_seccomp_entry -->|"gets default"| node_default_policy
node_seccomp_entry -->|"checks kernel"| node_kernel_check

click node_aa_runtime "https://github.com/moby/profiles/blob/main/apparmor/apparmor.go"
click node_aa_renderer "https://github.com/moby/profiles/blob/main/apparmor/template.go"
click node_seccomp_entry "https://github.com/moby/profiles/blob/main/seccomp/seccomp_linux.go"
click node_seccomp_types "https://github.com/moby/profiles/blob/main/seccomp/seccomp.go"
click node_default_policy "https://github.com/moby/profiles/blob/main/seccomp/default_linux.go"
click node_kernel_check "https://github.com/moby/profiles/blob/main/seccomp/kernel_linux.go"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_aa_runtime,node_aa_renderer toneBlue
class node_seccomp_entry,node_seccomp_types toneAmber
class node_default_policy,node_kernel_check toneMint
class node_callers,node_apparmor_parser toneIndigo
```

## Components

### AppArmor profiles

- [Profile install](https://github.com/moby/profiles/blob/main/apparmor/apparmor.go): `apparmor/apparmor.go`
- [Profile renderer](https://github.com/moby/profiles/blob/main/apparmor/template.go): `apparmor/template.go`

### Seccomp profile API

- [Profile loading](https://github.com/moby/profiles/blob/main/seccomp/seccomp_linux.go): `seccomp/seccomp_linux.go`
- [Profile schema](https://github.com/moby/profiles/blob/main/seccomp/seccomp.go): `seccomp/seccomp.go`

### Seccomp policy

- [Default syscall policy](https://github.com/moby/profiles/blob/main/seccomp/default_linux.go): `seccomp/default_linux.go`
- [Kernel version check](https://github.com/moby/profiles/blob/main/seccomp/kernel_linux.go): `seccomp/kernel_linux.go`

### Other components

- **Package callers**
- **apparmor_parser**

## Connections

- Package callers → Profile install: requests install (evidence: `README.md`)
- Profile install → Profile renderer: renders profile (evidence: `apparmor/apparmor.go`)
- Profile install → apparmor_parser: loads profile (evidence: `apparmor/apparmor.go`)
- Package callers → Profile loading: requests profile (evidence: `README.md`)
- Profile loading → Profile schema: decodes JSON (evidence: `seccomp/seccomp_linux.go`)
- Profile loading → Default syscall policy: gets default (evidence: `seccomp/seccomp_linux.go`)
- Profile loading → Kernel version check: checks kernel (evidence: `seccomp/seccomp_linux.go`)
