Batect in a nutshell

Rmag Breaking News

Batect is an alternative Docker Compose. For my own experience it is easier to use in terms of built-in features such as cross platform compatibility.

Unfortunately it is no longer maintained.

Its core is a yaml file that defines what containers to use and what tasks to execute. For example, I have one container called run-env and a task test-local which runs a line of command:

containers:
run-env:
build_directory: .
volumes:
– local: .
container: /code
– type: cache
container: /code/node_modules
name: node_modules
working_directory: /workdir
tasks:
test-local:
description: Run Playwright e2e Tests
run:
container: run-env
command: |
npx playwright test
environment:
ENVIRONMENT: local

Quick command to run locally:
./batect test-local

Troubleshooting

Issue: permission denied: ./batect

Run
chmod +x ./batect

Issue: Checksum unmatched for the download behind firewall

When running ‘./batect ‘ for the first time, batect will download jar from remote server.
Downloading Batect version 0.84.0 from https://updates.batect.dev/v1/files/0.84.0/batect-0.84.0.jar
To
/Users/{user}/.batect/cache/0.84.0/batect-0.84.0.jar

You might run into an issue:

The downloaded version of Batect does not have the expected checksum. Delete ‘/Users/{user}/.batect/cache/0.84.0/batect-0.84.0.jar’ and then re-run this script to download it again.

In this case, the solution is to paste the url of jar into Chrome to download directly, and overwrite the local jar file.

Leave a Reply

Your email address will not be published. Required fields are marked *