Container like ‘anka run’ interface for Anka macOS VM

Anka run command line interface enables command execution inside Anka macOS VMs directly from the host. It’s very similar to container docker run.

Why is this interesting – It allows Devops to take their existing container based Linux CI workflow automation, repurpose it for macOS and use it on Anka Build macOS Cloud infrastructure for iOS CI.

anka run --help

Usage: anka run [OPTIONS] VM_NAME COMMAND [ARGS]...

Run commands inside VM environment


-w, --workdir PATH Working directory inside the VM [optional]

-v, --volumes-from, --volume PATH
Mount host directory (current directory by
default) into VM . '--volumes-from' is
deprecated form [optional]

-n, --no-volumes-from, --no-volume
Use this flag to prevent implicit mounting
of current folder (see --volume option).
'--no-volumes-from' is deprecated form

-E, -e, --env Inherit environment variables. '-e' is
deprecated form [optional]

-f, --env-file PATH Provide environment variables from file

-N, --wait-network Wait till guest network interface up

‘anka run’ by default mounts the current folder from the host into the Anka macOS VM and executes commands on this mount point as the current directory. Upon completion of command execution, the mount directory is automatically released.
As a developer, this can be quite useful to be able to execute operations inside the VM environment in an isolated manner using artifacts/code residing on the developer machine.

anka run xcodebuild -sdk iphonesimulator -scheme Kickstarter-iOS build

–volume (-v) – Mount directory into VM. Mountpoint could be specified explicitly in this form:–volume /host/dir:/mountpoint, or assigned dynamically: –volume /host/dir. If no –workdir option is specified, mountpoint will be selected as working directory for running command.

Example :
anka run -v ~/Projects/anka:/tmp/anka run build

–no-volume (-n) – By default anka run command mounts current directory into VM, (implicit –volume $PWD option). Specify this option to disable implicit mounting. If no –workdir option is specified, working directory will be set to VM user’s home directory.

Example :

anka run -n xcodebuild -sdk iphonesimulator -scheme Kickstarter-iOS build - Will not mount the current host directory and execute build in the VM current directory.

–workdir (-w) – Specify working directory inside the VM

Example :

anka run -n -w /tmp/workspace/project git clone ${URL} src

anka run -n -w /tmp/workspace/project/src xcodebuild

–env (-E) – Inherit host environment variables in non-overriding mode.
Example :
CFLAGS=-O2 CC=clang anka run -E ${VM} make test.c

–env-file (-f) – Provide environment variables in overriding mode from file specified. Format of the environment file can be:



–wait-network (-N) – Resumed VMs require some time to reconfigure networking interface, so scripts which use networking immediately (e.g: git clone) could fail on network inaccessibility. This option postpones execution of the command till network is up. Incorporate it in your VM bootstrapping automation before starting to access network from inside the VM.

Share this post