The doctor command performs a comprehensive health check of your apicentric installation and environment.
No flags or arguments are required.
The doctor command runs the following diagnostic checks:
1. Apicentric version
Verifies that apicentric is properly installed and reports the current version.
2. Rust installation
Checks that Rust and Cargo are installed and accessible.
â
cargo 1.78.0 (c1083181f 2024-02-29)
Cargo is required for building and running apicentric from source.
3. Docker installation
Verifies Docker availability for the dockerize command.
â
Docker version 24.0.5, build ced0996
If Docker is not found:
â ī¸ Docker not found (required for 'dockerize' command)
Docker is optional. This is a warning, not an error.
4. Services directory
Checks for the default ./services directory.
If not found:
âšī¸ ./services not found (will be created on first use)
5. Configuration file
Looks for apicentric.json in the current directory.
If not found:
âšī¸ apicentric.json not found (using defaults)
Sample output
All checks passed
$ apicentric doctor
đĨ Apicentric Doctor
Checking your system for potential issues...
Checking apicentric version... â
v0.1.0
Checking Rust installation... â
cargo 1.78.0 (c1083181f 2024-02-29)
Checking Docker installation... â
Docker version 24.0.5, build ced0996
Checking services directory... â
Found ./services
Checking configuration... â
Found apicentric.json
⨠All systems operational! (5 checks passed) You are ready to build.
With warnings
$ apicentric doctor
đĨ Apicentric Doctor
Checking your system for potential issues...
Checking apicentric version... â
v0.1.0
Checking Rust installation... â
cargo 1.78.0 (c1083181f 2024-02-29)
Checking Docker installation... â ī¸ Docker not found (required for 'dockerize' command)
Checking services directory... âšī¸ ./services not found (will be created on first use)
Checking configuration... âšī¸ apicentric.json not found (using defaults)
⨠All systems operational! (5 checks passed) You are ready to build.
With failures
$ apicentric doctor
đĨ Apicentric Doctor
Checking your system for potential issues...
Checking apicentric version... â
v0.1.0
Checking Rust installation... â Cargo not found
Checking Docker installation... â ī¸ Docker not found (required for 'dockerize' command)
Checking services directory... âšī¸ ./services not found (will be created on first use)
Checking configuration... âšī¸ apicentric.json not found (using defaults)
â ī¸ Some issues were found (4 checks passed, 1 failed). Please review the errors above.
Exit codes
| Code | Meaning |
|---|
| 0 | All checks passed or only warnings |
| 1 | One or more critical checks failed |
When to run doctor
Run the doctor command:
- After installation: Verify everything is set up correctly
- Before deployment: Ensure production environment is ready
- When troubleshooting: Identify missing dependencies or configuration issues
- In CI/CD: Validate build environment before running tests
Fixing common issues
Cargo not found
Install Rust and Cargo from rustup.rs:
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
Docker not found
Install Docker from docker.com:
- macOS: Docker Desktop
- Windows: Docker Desktop or WSL2 with Docker Engine
- Linux: Docker Engine via package manager
Services directory missing
Create the directory manually:
Or let apicentric create it when you run simulator start.
Configuration file missing
Create a minimal configuration:
echo '{}' > apicentric.json
Or use the default configuration by not providing a file.
Use in scripts
The doctor command is useful in automation:
#!/bin/bash
if apicentric doctor; then
echo "Environment ready"
apicentric simulator start --services-dir ./services
else
echo "Environment check failed"
exit 1
fi
Dry run mode
The doctor command is not affected by --dry-run since it only reads system state.
apicentric --dry-run doctor
# Same output as without --dry-run
Next steps
- Fix any issues reported by doctor
- Create your first service definition
- Start the simulator with
apicentric simulator start