Skip to Content
āš ļø Dockflow is currently under development. Bugs may occur. Please report any issues on GitHub.
CLI Commands

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:

curl -fsSL https://raw.githubusercontent.com/Shawiizz/dockflow/main/install.sh | bash

The 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

BinaryPlatformArchitecture
dockflow-linux-x64Linuxx86_64
dockflow-linux-arm64LinuxARM64
dockflow-macos-x64macOSIntel
dockflow-macos-arm64macOSApple Silicon
dockflow-windows-x64.exeWindowsx86_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 hostname
  • port: SSH port
  • user: Deployment user
  • privateKey: SSH private key
  • password: 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

dockflow

Starts the interactive menu for guided setup.

Initialize Project

dockflow init # Interactive platform selection dockflow init github # GitHub Actions dockflow init gitlab # GitLab CI

Creates the .deployment/ folder structure with CI/CD configuration.

Deploy

dockflow deploy <env> [version] [options]

Deploy the application to the specified environment.

Options:

OptionDescription
--accessoriesDeploy only accessories (force redeploy)
--allDeploy app + force redeploy accessories
--skip-accessoriesSkip accessories check entirely
--services <list>Comma-separated list of services to deploy
--skip-buildSkip the build phase
--forceForce 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 accessories

Setup 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-time

Exec

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 access

Restart

Force restart of services (rolling update).

dockflow restart <env> [service]

Examples:

dockflow restart production # All services dockflow restart production app # Specific service

Stop

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 workers

Rollback

Rollback a service to its previous version.

dockflow rollback <env> [service]

Examples:

dockflow rollback production app # Rollback specific service dockflow rollback production # Rollback all services

PS

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:

OptionDescription
-a, --allRemove all unused images, not just dangling ones
--imagesPrune images only
--containersPrune containers only
--volumesPrune volumes only (āš ļø deletes data!)
--networksPrune networks only
-y, --yesSkip 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> # Alias

Shows 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 logs

Accessories 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-cli

Restart 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]
OptionDescription
-v, --volumesAlso remove volumes (āš ļø DESTRUCTIVE)
-y, --yesSkip confirmation prompt

The --volumes flag permanently deletes all data. You will be prompted to type the environment name to confirm.

Requirements

  • .env.dockflow with connection strings
  • .deployment/config.yml with project_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 setup

When 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 check

Get Connection String

Display connection string for existing deployment user:

dockflow setup connection

Examples

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