CLI Commands
Dockflow provides a comprehensive CLI for managing your deployments and interacting with running services.
Installation
Install the Dockflow CLI using the installation script:
Linux / macOS
curl -fsSL https://raw.githubusercontent.com/Shawiizz/dockflow/main/install.sh | bashThe script automatically detects your platform and architecture, downloads the appropriate binary, and adds it to your PATH.
The CLI binary is self-contained and requires no external dependencies for most commands.
Use dockflow setup on the target Linux host, or dockflow setup remote from any platform to configure a remote server via SSH.
Available Binaries
| Binary | Platform | Architecture |
|---|---|---|
dockflow-linux-x64 | Linux | x86_64 |
dockflow-linux-arm64 | Linux | ARM64 |
dockflow-macos-x64 | macOS | Intel |
dockflow-macos-arm64 | macOS | Apple Silicon |
dockflow-windows-x64.exe | Windows | x86_64 |
Connection Configuration
App commands require connection strings configured as CI secrets or in .env.dockflow for local development:
# .env.dockflow (for local CLI usage)
PRODUCTION_MAIN_SERVER_CONNECTION=eyJob3N0Ijoi... # Base64-encoded JSON
STAGING_STAGING_SERVER_CONNECTION=eyJob3N0Ijoi...The connection string is generated by dockflow setup and contains:
host: Server IP or hostnameport: SSH portuser: Deployment userprivateKey: SSH private keypassword: User password (optional)
Server names use underscores in secrets. A server named main_server in servers.yml uses MAIN_SERVER in the secret name.
General Commands
Interactive Mode
dockflowStarts the interactive menu for guided setup.
Initialize Project
dockflow init # Interactive platform selection
dockflow init github # GitHub Actions
dockflow init gitlab # GitLab CICreates the .deployment/ folder structure with CI/CD configuration.
Deploy
dockflow deploy <env> [version] [options]Deploy the application to the specified environment.
Options:
| Option | Description |
|---|---|
--accessories | Deploy only accessories (force redeploy) |
--all | Deploy app + force redeploy accessories |
--skip-accessories | Skip accessories check entirely |
--services <list> | Comma-separated list of services to deploy |
--skip-build | Skip the build phase |
--force | Force deployment even if locked |
--server <name> | Deploy to specific server only (deploys to all by default) |
Automatic accessories detection: By default, Dockflow checks if accessories.yml has changed and automatically deploys accessories when needed. Use --skip-accessories to disable this behavior.
Examples:
dockflow deploy production 1.0.0 # Deploy to all production servers
dockflow deploy staging # Auto-generated version
dockflow deploy production --server main_server # Deploy to specific server
dockflow deploy production --accessories # Force redeploy accessories only
dockflow deploy production --all # Deploy app + force redeploy accessories
dockflow deploy production --skip-accessories # Deploy app, ignore accessoriesSetup Machine
dockflow setup-machine [options]Configure a server for deployments. See dockflow setup-machine --help for all options.
App Commands
These commands interact with deployed services via SSH.
Logs
View logs from running services.
dockflow logs <env> [service] [-f]Examples:
dockflow logs production # All services (last 50 lines each)
dockflow logs production app # Specific service
dockflow logs production app -f # Follow logs in real-timeExec
Execute a command inside a running container.
dockflow exec <env> <service> [command]Examples:
dockflow exec production app bash # Interactive shell
dockflow exec production app sh # Alpine containers
dockflow exec production app "ls -la" # Run command
dockflow exec production db "psql -U user" # Database accessRestart
Force restart of services (rolling update).
dockflow restart <env> [service]Examples:
dockflow restart production # All services
dockflow restart production app # Specific serviceStop
Stop and remove the entire stack.
dockflow stop <env>This will prompt for confirmation before removing all services.
Details
Show comprehensive information about the stack.
dockflow details <env>Displays:
- All services with replica status
- Running tasks
- Resource usage (CPU, memory)
SSH
Open an interactive SSH session to the server.
dockflow ssh <env>Scale
Scale a service to a specified number of replicas.
dockflow scale <env> <service> <replicas>Examples:
dockflow scale production app 3 # Scale to 3 replicas
dockflow scale production worker 5 # Scale workersRollback
Rollback a service to its previous version.
dockflow rollback <env> [service]Examples:
dockflow rollback production app # Rollback specific service
dockflow rollback production # Rollback all servicesPS
List running containers for the stack.
dockflow ps <env>Prune
Remove unused Docker resources (images, containers, volumes, networks) from the remote server.
dockflow prune <env> [options]Options:
| Option | Description |
|---|---|
-a, --all | Remove all unused images, not just dangling ones |
--images | Prune images only |
--containers | Prune containers only |
--volumes | Prune volumes only (ā ļø deletes data!) |
--networks | Prune networks only |
-y, --yes | Skip confirmation prompt |
Examples:
dockflow prune production # Prune all resources (with confirmation)
dockflow prune production -y # Prune all without confirmation
dockflow prune production --images # Only prune images
dockflow prune production --images -a # Prune ALL unused images (not just dangling)
dockflow prune production --volumes # Only prune volumes (careful!)The --volumes option will permanently delete data stored in Docker volumes that are not currently attached to any container. Use with caution!
Output:
- Shows space reclaimed for each resource type
- Displays current disk usage after cleanup (
docker system df)
Accessories Commands
Accessories are stateful services (databases, caches, etc.) with a separate lifecycle from your main app. See Accessories Configuration for setup details.
List Accessories
dockflow accessories list <env>
dockflow acc ls <env> # AliasShows all accessories services with status and replicas.
Accessories Logs
dockflow accessories logs <env> [service] [-f]Examples:
dockflow acc logs production # All accessories
dockflow acc logs production postgres # Specific service
dockflow acc logs production postgres -f # Follow logsAccessories Exec
dockflow accessories exec <env> <service> [command]Examples:
dockflow acc exec production postgres # Open shell
dockflow acc exec production postgres psql # Run psql
dockflow acc exec production redis redis-cli # Run redis-cliRestart Accessories
dockflow accessories restart <env> [service]Force restart of accessories services.
Stop Accessories
dockflow accessories stop <env> [service]Scale accessories to 0 replicas (keeps containers and volumes).
Remove Accessories
dockflow accessories remove <env> [options]| Option | Description |
|---|---|
-v, --volumes | Also remove volumes (ā ļø DESTRUCTIVE) |
-y, --yes | Skip confirmation prompt |
The --volumes flag permanently deletes all data. You will be prompted to type the environment name to confirm.
Requirements
.env.dockflowwith connection strings.deployment/config.ymlwithproject_name
For setup commands (on target Linux host):
- Ansible (
ansible,ansible-playbook) - SSH (
ssh,ssh-keygen)
Setup Commands
Interactive Setup
Configure a server for deployments with the interactive wizard:
dockflow setupWhen running on Windows or macOS, the CLI will prompt you to connect to your Linux server via SSH and run the setup remotely.
Remote Setup
Explicitly run setup on a remote Linux server from any platform:
dockflow setup remote [options]Options:
--host <host>- Remote server IP or hostname--port <port>- SSH port (default: 22)--user <user>- SSH username--password <password>- SSH password--key <path>- Path to SSH private key--connection <string>- Use existing Dockflow connection string
Examples:
# Interactive remote setup
dockflow setup remote
# With SSH key
dockflow setup remote --host 192.168.1.10 --user root --key ~/.ssh/id_ed25519
# With password
dockflow setup remote --host 192.168.1.10 --user root --password "secret"
# With existing connection string
dockflow setup remote --connection "eyJob3N0Ijoi..."Non-Interactive Setup (Linux only)
Configure a server without prompts (must be run directly on the target Linux host):
dockflow setup auto [options]Options:
--host <host>- Public IP/hostname for connection string--port <port>- SSH port (default: 22)--user <user>- Deployment username--password <password>- Password for new user or sudo--ssh-key <path>- Path to existing SSH private key--generate-key- Generate new SSH key--skip-docker-install- Skip Docker installation--portainer- Install Portainer--portainer-port <port>- Portainer HTTP port (default: 9000)--portainer-password <password>- Portainer admin password--portainer-domain <domain>- Portainer domain name
Check Dependencies
Verify all required dependencies are installed:
dockflow setup checkGet Connection String
Display connection string for existing deployment user:
dockflow setup connectionExamples
Full workflow:
# 1. Setup your server (from Windows/macOS or directly on the server)
dockflow setup
# Or with remote setup explicitly
dockflow setup remote --host 192.168.1.10 --user root --key ~/.ssh/id_ed25519
# 2. Save the connection string to .env.dockflow
echo "PRODUCTION_CONNECTION=..." > .env.dockflow
# 3. Initialize project structure
dockflow init github
# 4. Deploy accessories (databases, caches) - do this once
dockflow deploy production --accessories
# 5. Deploy your app (via CI/CD or manually)
dockflow deploy production 1.0.0
# 6. Monitor your deployment
dockflow logs production -f
dockflow details production
# 7. Troubleshoot if needed
dockflow exec production app bash
dockflow ssh production
# 8. Scale as needed
dockflow scale production app 3
# 9. Rollback if something goes wrong
dockflow rollback production app
# 10. Manage accessories
dockflow acc logs production postgres -f # Database logs
dockflow acc exec production postgres psql # Connect to DB