DoMD includes a powerful command testing system that can validate and test shell commands in isolated Docker containers. This helps ensure that commands work as expected across different environments.
.doignore
with commands that fail in Docker# Test individual commands
domd test-commands "ls -la" "pwd" "echo Hello"
# Test commands from a file
domd test-commands -f commands.txt
# Test commands and update .doignore
domd test-commands --update-doignore -f commands.txt
# Skip Docker testing (only validate commands)
domd test-commands --no-docker -f commands.txt
# Specify custom .dodocker and .doignore paths
domd test-commands --dodocker custom.dodocker --doignore .customignore -f commands.txt
-f, --file
: Read commands from a file (one per line)--update-doignore
: Update .doignore with commands that fail in Docker--dodocker
: Path to .dodocker configuration file (default: .dodocker)--doignore
: Path to .doignore file (default: .doignore)--no-docker
: Skip Docker testing and only validate commands-v, --verbose
: Enable verbose outputPOST /api/commands/validate
Content-Type: application/json
Authorization: Bearer YOUR_TOKEN
{
"commands": ["ls -la", "pwd", "echo Hello"],
"test_in_docker": true,
"update_doignore": true
}
POST /api/commands/test-docker
Content-Type: application/json
Authorization: Bearer YOUR_TOKEN
{
"commands": ["ls -la", "pwd", "echo Hello"],
"update_doignore": true
}
POST /api/commands/ignore
Content-Type: application/json
Authorization: Bearer YOUR_TOKEN
{
"commands": ["invalid_command"],
"comment": "These commands don't work in our environment"
}
The .dodocker
file specifies how commands should be executed in Docker. Here’s an example:
# Run Python commands in Python container
python:
image: python:3.9-slim
description: Python interpreter
workdir: /app
# Run Node.js commands in Node container
node:
image: node:16
description: Node.js runtime
workdir: /app
volumes:
./:/app
# Commands with specific requirements
"npm install":
image: node:16
description: Install Node.js dependencies
workdir: /app
volumes:
./:/app
~/.npm:/root/.npm
--no-docker
first to validate commands before Docker testing.doignore
with commands that are known to faildocker ps
to verify Docker is workingsudo
or add your user to the docker
groupsudo usermod -aG docker $USER
.dodocker
to include required toolsubuntu:latest
for testing--network host
to Docker run options in .dodocker
if needed