loop-task

Docker

Run loop-task in a Docker container with persistent state.

Why Docker?

Running loop-task in Docker keeps your host clean, makes state portable, and works great in CI. The official image is node:20-slim based - minimal, secure, and well-maintained.

Basic usage

Run the board interactively with a single command:

docker run -it --rm \
  -v loop-task-data:/root/.loop-cli \
  node:20-slim npx loop-task
FlagPurpose
-itAllocates a pseudo-TTY - required for the interactive board UI
--rmRemoves the container when it exits - no cleanup needed
-v loop-task-data:/root/.loop-cliMounts a named Docker volume so your loops and state survive restarts

Create loops in a container

Run the daemon in the background, then create loops via docker exec:

docker run -d --name loop-daemon \
  -v loop-task-data:/root/.loop-cli \
  node:20-slim npx loop-task start

docker exec loop-daemon npx loop-task new 30m -- npm test

The first command starts the daemon in detached mode (-d). The second sends a new command directly inside the running container - the daemon picks it up immediately.

Using the HTTP API from the host

Map the port to access the HTTP API and interactive Swagger UI from your browser:

docker run -d --name loop-daemon \
  -v loop-task-data:/root/.loop-cli \
  -p 8845:8845 \
  -e LOOP_CLI_HTTP_PORT=8845 \
  node:20-slim npx loop-task start

Then open http://localhost:8845/api/docs for the Swagger UI. Every endpoint is available from the host as if loop-task were running natively.

Dockerfile

A minimal Dockerfile for production or repeatable deployments:

FROM node:20-slim
RUN npm install -g loop-task
VOLUME /root/.loop-cli
EXPOSE 8845
CMD ["loop-task", "start"]

Build and run:

docker build -t loop-task .
docker run -d --name loop-daemon \
  -v loop-task-data:/root/.loop-cli \
  -p 8845:8845 \
  -e LOOP_CLI_HTTP_PORT=8845 \
  loop-task

Docker Compose

For a reproducible setup with a single command, use Docker Compose:

version: '3.8'
services:
  loop-task:
    build: .
    volumes:
      - loop-data:/root/.loop-cli
    ports:
      - "8845:8845"
    environment:
      - LOOP_CLI_HTTP_PORT=8845
    restart: unless-stopped
volumes:
  loop-data:

Start with:

docker compose up -d

Three interfaces in Docker

Once the container is running, you have full access to all three loop-task interfaces:

InterfaceCommand
CLIdocker exec loop-daemon loop-task status
TUI (board)docker exec -it loop-daemon loop-task
HTTP APIcurl http://localhost:8845/api/... (when port is mapped)
  • CLI commands are non-interactive - perfect for scripts and health checks.
  • The TUI requires -it for an interactive terminal.
  • The HTTP API needs -p 8845:8845 at container start and is accessible from any HTTP client on the host.