This page reflects the options available in the most recent version of Batect.
If you are not running the most recent version, run
./batect --help to see what options are available in your version.
Run a task by running
./batect <task-name>. For example, to run
You can also pass arguments to the task command by passing those arguments by running
./batect <task-name> -- <args...>.
For example, to run the task
the-task with the arguments
arg1 arg2, run
./batect the-task -- arg1 arg2.
See the shell tab completion section for information on supported shells and installation instructions.
--cache-type: Set cache type to use
--clean: Clean up all caches for this project
-f: Use a non-standard configuration file name
--config-vars-file: Set config variables from a file
--config-var: Set a config variable
--disable-ports: Disable port binding on the host machine
--docker-host: Use a non-standard Docker host
--docker-tls-key: Customise certificates used to provide authentication to daemon and to verify daemon's identity
--docker-tls-verify: Connect to Docker over TLS
--enable-buildkit: Use BuildKit to build images
--help: Get help for Batect's CLI
--linux-cache-init-image: Set cache initialisation image
-T: See a list of available tasks
--log-file: Create a debugging log
--max-parallelism: Set maximum setup and cleanup operations to run in parallel
--no-color: Disable coloured output
--no-cleanup-after-success: Disable cleaning up
--no-proxy-vars: Disable propagation of proxy-related environment variables
--no-telemetry: Disable telemetry for this invocation
--no-update-notification: Disable update notification
--no-wrapper-cache-cleanup: Disable wrapper cache cleanup
--override-image: Override the image used by a container
-o: Force a particular output style
--permanently-disable-telemetry: Disable telemetry permanently
--permanently-enable-telemetry: Enable telemetry permanently
--skip-prerequisites: Skip prerequisites
--use-network: Use an existing network for tasks
--upgrade: Upgrade Batect
--version: Get Batect, Docker and OS version information
By default, Batect will use a Docker volume for each cache for Linux containers. Use this option to instruct Batect to use a different storage mechanism.
Supported values are:
volume: use Docker volumes
directory: use directories mounted from the project's
BATECT_CACHE_TYPE environment variable can also be used to set the default cache type. If both the environment
variable and the
--cache-type option are set, the value given with
--cache-type takes precedence.
This option has no effect on Windows containers. Windows containers always use directory mounts for caches.
./batect --clean will remove all caches created for this project.
This command respects the value of the
--cache-type option and the
BATECT_CACHE_TYPE environment variable.
By default, Batect will use a configuration file called
batect.yml in the current directory.
Use this option to instruct Batect to use a different file.
By default, Batect will automatically apply values for config variables from the YAML file
if it exists.
--config-vars-file to specify a different file to use instead of
Values provided with
--config-var take precedence over values provided in any file.
--config-vars to specify values for an individual config variable.
Values must be in the format
<variable name>=<variable value>.
Values provided with
--config-var take precedence over values provided in a file (either explicitly with
--config-vars-file or from the default
and default values defined in the configuration file.
However, in some situations, it can be useful to disable these bindings. In particular, when running multiple tasks in parallel, such as on CI systems, host port bindings can result in conflicts.
--disable-ports disables all port bindings for all containers. This includes port bindings defined at the task level.
By default, Batect will connect to the Docker daemon using the path provided in the
DOCKER_HOST environment variable, or
the default path for your operating system if
DOCKER_HOST is not set. Use this option to instruct Batect to use a different path.
If your Docker daemon requires TLS, Batect needs three files in order to connect to it:
- the CA certificate that can be used to verify certificates presented by the Docker daemon (
- the certificate that can be used to prove your identity to the Docker daemon (
--docker-tls-cert) and corresponding private key (
By default, these files are stored in
~/.docker and are named
You can instruct Batect use a non-default location for any of these files with the options mentioned above, or override the default directory for these
--docker-cert-path. If the
DOCKER_CERT_PATH environment variable is set, Batect will use that as the default directory.
DOCKER_CERT_PATH) and a path for an individual file is provided, the path for the individual file takes precedence.
These options mirror the behaviour of the
By default, the Docker daemon only accepts plaintext connections from the local machine. If your daemon requires TLS, use the
to instruct Batect to use TLS. Batect will also automatically enable this option if the
DOCKER_TLS_VERIFY environment variable is set to
If your daemon presents a certificate that does not match its hostname, use the
--docker-tls option (without
--docker-tls-verify) to instruct
Batect to not verify the hostname.
--docker-tls-verify is insecure and should only be used if you understand the implications of this.
These options mirror the behaviour of the
Support for BuildKit in Batect is considered experimental. Please file an issue if you encounter any problems.
By default, Batect will use the legacy builder to build Docker images. Docker recently introduced a new image builder, BuildKit, that offers improved performance and some new features.
Use this option to instruct Batect to use BuildKit to build images, rather than the legacy image builder.
Batect will automatically enable this flag if the
DOCKER_BUILDKIT environment variable is set to
Note that BuildKit is only supported on Docker 18.09 or later, or on earlier versions when Docker is running with experimental features enabled.
./batect --help will show a summary of the options available on the command line.
Batect uses an image to initialise cache volumes before they are mounted. Use this option to override the default image. This is useful if you have cached the initialisation image on a local registry.
BATECT_LINUX_CACHE_INIT_IMAGE environment variable can also be used to set the default initialisation image. If both the environment
variable and the
--linux-cache-init-image option are set, the value given with
--linux-cache-init-image takes precedence.
./batect --list-tasks produces output like this:
When combined with
--output=quiet, Batect produces output suitable for parsing by other applications.
Tasks are listed in alphabetical order, with one task per line. Each task is followed by a tab character, then
./batect --list-tasks --output=quiet produces output like this:
Use this option to instruct Batect to generate a debugging log at the specified path as it runs. This may be requested if you submit an issue.
If the log file already exists, Batect will append further log messages to the end of the file.
By default, Batect will try to run all setup and cleanup steps in parallel, as described in the task lifecycle. On some machines, this can overwhelm the Docker daemon, leading to timeouts and other issues. Use this option to limit the number of setup or cleanup steps to run in parallel.
Note that this does not limit the number of containers that can run in parallel.
By default, Batect will produce coloured output if it detects that your console supports it. However, sometimes Batect may incorrectly believe your console supports coloured output, or your console may incorrectly report that it supports coloured output when it does not. (This is a common issue with some CI systems.) This can lead to garbled or difficult to read output.
Passing this flag will disable all coloured output, even if Batect believes your console supports it.
By default, Batect will automatically cleanup all containers and other resources it creates while running a task. However, sometimes it can be useful to leave all the created containers running to diagnose issues running a task.
--no-cleanup-after-failureto not clean up if any task fails to start for any reason.
--no-cleanup-after-successto not clean up the containers and other resources created for the main task (the one specified on the command line) if it succeeds.
--no-cleanupto enable both of the above.
By default, Batect will automatically propagate proxy-related environment variables as described here. Use this option to disable this behaviour.
By default, Batect uses the permission you granted it when it ran for the first time.
If you would like to disable telemetry collection or uploading for a single invocation, pass the
--no-telemetry flag, for example:
Note that this does not cause any data that has been collected from other invocations but not uploaded to be removed - it will be uploaded the next time
Batect runs without the
You can also set the
BATECT_ENABLE_TELEMETRY environment variable to
false to disable telemetry collection and uploading.
Batect automatically checks for updates at most once every 24 hours and displays a notification if a newer version is available.
Passing this flag will disable both the update check and notification.
This flag is automatically enabled if
--output is set to
Batect automatically removes old versions of itself that have been downloaded and cached locally if they haven't been used in 30 days.
Passing this flag will disable this cleanup process. You can manually remove these files from
~/.batect/cache yourself at any time.
Use this option to override the value in the configuration file and use a different image for a specific container.
Values must be in the format
Batect offers four styles of output:
fancyis best for interactive use, providing very clean output about the current state of execution and showing output from only the task containerLoading...
simpleis best for non-interactive use (eg. on CI), providing a log of what happened and showing output from only the task containerLoading...
alldisplays output from all containersLoading...
quietdisplays only the output from the task and error messages from BatectLoading...
There are some differences between these output styles to be aware of:
|Progress information||Detailed (eg. download % completed, health check status)||Basic (eg. image pull started, container ready)||Errors only||Basic (eg. image pull started, container ready)|
|Displays output from||Task container only||Task container only||Task container only||All containers|
|stdin connected (if present)||Yes, to task container only||Yes, to task container only||Yes, to task container only||No|
|TTY connected (if present)||Yes, to task container only||Yes, to task container only||Yes, to task container only||No|
|Image build output shown||Only on build failure||Only on build failure||Only on build failure||Always|
By default, Batect will automatically pick an output style that it believes is appropriate for the environment it is running in -
fancy if it believes your environment supports it, or
Passing this flag allows you to override what Batect believes is appropriate.
--output=quiet also modifies the output of
to make it easier to parse with other applications.
If you would like to opt-out of telemetry, run
./batect --permanently-disable-telemetry to disable collecting telemetry data and
remove any data that has been collected but not yet uploaded.
This also resets your telemetry user ID, ensuring that if you do ever re-enable telemetry, any previous data uploaded is not associated with any new data.
If you would like to opt-in to telemetry, run
./batect --permanently-enable-telemetry to enable collecting telemetry data.
Normally, Batect will run all tasks defined as prerequisites for the task given on the command line, before then running the requested task.
Use this option to run only the requested task.
By default, Batect will create a new Docker network for each task, as described in the task lifecycle. Use this option to provide an existing network to use for all tasks.
./batect --upgrade will automatically upgrade Batect in the current project to the latest
./batect --version will show a summary of the versions of Batect, Docker and your operating
system, which can be useful when diagnosing issues with Batect.