# Extract Oci Archive

> Use when you need to extract an OCI archive to inspect its contents, get the rootfs layer, or read the image config.

- Skill: `coreos/extract-oci-archive` (Agent Skill)
- Install (CLI): `npx skillmds@latest add coreos/extract-oci-archive`
- Raw SKILL.md: https://api.skillmd.com/api/skills/coreos/extract-oci-archive/raw
- Safety review: pending
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: Coding & Dev Tools
- Author: coreos (https://skillmd.com/u/coreos)
- Updated: 2026-09-17
- Page: https://skillmd.com/skills/coreos/extract-oci-archive

---


# Extract OCI Archive

## Extract the OCI archive structure

```bash
mkdir /tmp/oci-extracted
tar -xf /path/to/image.ociarchive -C /tmp/oci-extracted
```

## Get the manifest digest from index.json

```bash
MANIFEST=$(jq -r '.manifests[0].digest' /tmp/oci-extracted/index.json \
    | cut -d: -f2)
```

## Extract a layer to get the rootfs

For a single-layer image:

```bash
LAYER=$(jq -r '.layers[0].digest' \
    /tmp/oci-extracted/blobs/sha256/${MANIFEST} | cut -d: -f2)
mkdir /tmp/rootfs
tar -xf /tmp/oci-extracted/blobs/sha256/${LAYER} -C /tmp/rootfs
```

For multi-layer images, extract each layer in order and overlay them.

## Read the image config

The config contains the created timestamp, entrypoint, labels, etc.:

```bash
CONFIG=$(jq -r '.config.digest' \
    /tmp/oci-extracted/blobs/sha256/${MANIFEST} | cut -d: -f2)
jq . /tmp/oci-extracted/blobs/sha256/${CONFIG}
```

