wheels deploy exec
Execute commands in deployed containers.
Synopsis
Description
The wheels deploy:exec
command allows you to execute commands inside deployed Docker containers on your servers. This is useful for running administrative tasks, debugging, or accessing services directly.
Arguments
command
- Command to execute in container (required)
Options
servers=<string>
- Execute on specific servers (comma-separated list)service=<string>
- Service to execute in: app or db (default: app)--interactive
- Run command interactively (default: false)
Examples
List files in application container
Run database migrations
Access CommandBox REPL interactively
Execute MySQL commands in database container
Check application logs
Execute on specific server
How It Works
The command:
Connects to target servers via SSH
Determines the container name based on service
Executes the command using
docker exec
Returns the output or provides interactive access
Service Selection
Application Container (default)
Database Container
Interactive vs Non-Interactive
Non-Interactive (default)
Command runs and returns output
Suitable for simple commands
Output is captured and displayed
Interactive Mode
Provides terminal access
Required for commands needing input
Useful for REPL, database shells, etc.
Output Example
Non-interactive command
Multiple servers
Common Use Cases
Administrative Tasks
Database Operations
Debugging
File Management
Security Considerations
Command Injection: Commands are passed directly to the shell
Permissions: Runs with container user permissions
Sensitive Data: Be careful with commands that expose secrets
Audit Trail: Commands are not logged by default
Limitations
Cannot execute commands requiring GUI
Interactive mode requires TTY support
Output limited by SSH buffer size
No automatic error handling
Best Practices
Quote Complex Commands: Use quotes for commands with special characters
Test First: Test commands locally before running in production
Use Service Parameter: Specify service explicitly for clarity
Avoid Sensitive Output: Redirect sensitive data to files
Check Exit Codes: Verify command success in scripts
Troubleshooting
Container Not Found
Verify deployment is active
Check container name matches service name
Ensure Docker is running
Permission Denied
Check SSH user has Docker access
Verify container user permissions
Use sudo if necessary (configure in deploy.json)
Command Not Found
Ensure command exists in container
Check PATH environment variable
Use full path to executables
Interactive Mode Issues
Ensure terminal supports TTY
Use SSH directly for complex interactions
Check SSH client configuration
See Also
wheels deploy:status - Check deployment status
wheels deploy:logs - View deployment logs
wheels deploy:push - Deploy application
Last updated
Was this helpful?