Command Reference
The apko
command provides a powerful toolset for building, publishing, and managing container images. This section outlines the available commands, their options, and usage examples.
apko build
The apko build
command is the primary tool for building container images. It takes a set of configuration files and produces a container image.
Usage:
apko build [options] <config-path> [output-image-name]
Options:
-h, --help
: Display help for the command.--no-cache
: Disable caching of layers.--push
: Push the image to a registry after building.--push-retries
: Specify the number of retries for pushing the image to a registry. (default: 3)--push-timeout
: Specify the timeout (in seconds) for pushing the image to a registry. (default: 30)-v, --verbose
: Enable verbose output during the build process.-t, --tag
: Specify a tag for the image.--context
: Specify the context directory to use for the build.--output
: Specify the output directory for the built image.--platform
: Specify the target platform for the build. (default: auto-detected)--dockerfile
: Specify a Dockerfile to use for the build.--layers
: Specify the layers to build.--squash
: Squash all image layers into a single layer.--label
: Set a label on the image. Can be used multiple times to set multiple labels.--workdir
: Set the working directory for the image.--entrypoint
: Set the entrypoint for the image.--cmd
: Set the default command for the image.--user
: Set the user for the image.--env
: Set an environment variable for the image. Can be used multiple times to set multiple environment variables.--build-arg
: Set a build argument for the image. Can be used multiple times to set multiple build arguments.--secrets
: Specify the secrets to be used in the build.--cache-dir
: Specify the directory to use for caching.--registry
: Specify the registry to use for pushing.--insecure
: Skip TLS verification for the registry.--auth
: Specify the authentication credentials for the registry.--pull
: Pull the base image if it’s not available locally.--force
: Force a rebuild of the image even if the image already exists.
Examples:
# Build a simple image from a configuration file
apko build config.yaml my-image:latest
# Build an image with a specific tag
apko build config.yaml my-image:v1.0.0
# Build an image and push it to a registry
apko build config.yaml my-image:latest --push
# Build an image and push it to a registry with specific credentials
apko build config.yaml my-image:latest --push --auth my-registry:username:password
Source: cmd/apko/build.go
apko publish
The apko publish
command publishes a container image to a registry.
Usage:
apko publish [options] <image-name>
Options:
-h, --help
: Display help for the command.--push-retries
: Specify the number of retries for pushing the image to a registry. (default: 3)--push-timeout
: Specify the timeout (in seconds) for pushing the image to a registry. (default: 30)-v, --verbose
: Enable verbose output during the publish process.--registry
: Specify the registry to use for pushing.--insecure
: Skip TLS verification for the registry.--auth
: Specify the authentication credentials for the registry.--force
: Force a push even if the image already exists in the registry.
Examples:
# Publish an image to a registry
apko publish my-image:latest
# Publish an image to a registry with specific credentials
apko publish my-image:latest --auth my-registry:username:password
Source: cmd/apko/publish.go
apko push
The apko push
command pushes a container image to a registry.
Usage:
apko push [options] <image-name>
Options:
-h, --help
: Display help for the command.--push-retries
: Specify the number of retries for pushing the image to a registry. (default: 3)--push-timeout
: Specify the timeout (in seconds) for pushing the image to a registry. (default: 30)-v, --verbose
: Enable verbose output during the push process.--registry
: Specify the registry to use for pushing.--insecure
: Skip TLS verification for the registry.--auth
: Specify the authentication credentials for the registry.--force
: Force a push even if the image already exists in the registry.
Examples:
# Push an image to a registry
apko push my-image:latest
# Push an image to a registry with specific credentials
apko push my-image:latest --auth my-registry:username:password
Source: cmd/apko/push.go
apko pull
The apko pull
command pulls a container image from a registry.
Usage:
apko pull [options] <image-name>
Options:
-h, --help
: Display help for the command.-v, --verbose
: Enable verbose output during the pull process.--registry
: Specify the registry to use for pulling.--insecure
: Skip TLS verification for the registry.--auth
: Specify the authentication credentials for the registry.--platform
: Specify the target platform for the pull. (default: auto-detected)
Examples:
# Pull an image from a registry
apko pull my-image:latest
# Pull an image from a registry with specific credentials
apko pull my-image:latest --auth my-registry:username:password
Source: cmd/apko/pull.go
apko tag
The apko tag
command tags a container image.
Usage:
apko tag [options] <source-image> <target-image>
Options:
-h, --help
: Display help for the command.-v, --verbose
: Enable verbose output during the tag process.--force
: Force a tag even if the target image already exists.
Examples:
# Tag an image with a new name
apko tag my-image:latest my-image:v1.0.0
# Tag an image with a new tag
apko tag my-image:latest my-image:latest-tag
Source: cmd/apko/tag.go
apko inspect
The apko inspect
command inspects a container image.
Usage:
apko inspect [options] <image-name>
Options:
-h, --help
: Display help for the command.-v, --verbose
: Enable verbose output during the inspect process.--format
: Specify the format for the output.--config
: Print the image configuration.--history
: Print the image history.--layers
: Print the image layers.--manifest
: Print the image manifest.--os
: Print the image operating system.--architecture
: Print the image architecture.--digest
: Print the image digest.--labels
: Print the image labels.--env
: Print the image environment variables.--build-args
: Print the image build arguments.
Examples:
# Inspect an image and print the image configuration
apko inspect my-image:latest --config
# Inspect an image and print the image history
apko inspect my-image:latest --history
Source: cmd/apko/inspect.go
apko delete
The apko delete
command deletes a container image.
Usage:
apko delete [options] <image-name>
Options:
-h, --help
: Display help for the command.-v, --verbose
: Enable verbose output during the delete process.--force
: Force a delete even if the image is being used by other containers.--all
: Delete all images matching the image name.
Examples:
# Delete an image
apko delete my-image:latest
# Delete all images matching the image name
apko delete my-image:latest --all
Source: cmd/apko/delete.go
apko login
The apko login
command logs in to a container registry.
Usage:
apko login [options] <registry>
Options:
-h, --help
: Display help for the command.-v, --verbose
: Enable verbose output during the login process.--username
: Specify the username for the registry.--password
: Specify the password for the registry.--insecure
: Skip TLS verification for the registry.
Examples:
# Login to a registry
apko login my-registry
# Login to a registry with specific credentials
apko login my-registry --username my-username --password my-password
Source: cmd/apko/login.go
apko logout
The apko logout
command logs out of a container registry.
Usage:
apko logout [options] <registry>
Options:
-h, --help
: Display help for the command.-v, --verbose
: Enable verbose output during the logout process.
Examples:
# Logout of a registry
apko logout my-registry
Source: cmd/apko/logout.go
apko version
The apko version
command prints the apko version.
Usage:
apko version
Options:
-h, --help
: Display help for the command.-v, --verbose
: Enable verbose output.
Source: cmd/apko/version.go