apko YAML Reference

This page provides a reference for apko’s YAML specification.

contents

This section defines sources and packages you want to include in your image.

DirectiveDescription
repositoriesA list of apk repositories for this image. Supports either Alpine or Wolfi apk repositories.
packagesA list containing all packages that should be installed as part of a given image’s requirements.

*It is not recommended to mix Alpine apks with Wolfi apks.

Example:

contents:
  repositories:
    - https://dl-cdn.alpinelinux.org/alpine/edge/main
  packages:
    - alpine-base

entrypoint

This section defines an entry point command for your image.

DirectiveDescription
commandThe command that should be executed as entry point for this image.

Example:

entrypoint:
  command: /usr/bin/php81

archs

The architectures to build. This top-level directive expects a list with all architectures that should be a target for the build. By default, apko will try to build for all architectures that are currently supported.

Example:

archs:
  - x86_64

environment

This section defines environment variables that will be set for this image.

Example:

environment:
  PATH: /usr/sbin:/sbin:/usr/bin:/bin
  myVAR: "test"

accounts

This section defines users and groups that should be added to this image.

DirectiveDescription
groupsA list with the groups that should be present in this image.
usersA list with the user accounts that should be present in this image.
run-asThe default user to run the entrypoint command.

Example:

accounts:
  groups:
    - groupname: nonroot
      gid: 65532
  users:
    - username: nonroot
      uid: 65532
  run-as: root