A CLI tool to manage Magento Docker environments — wraps docker compose, runs Magento/WordPress tooling inside containers, and syncs configurable Docker template files from a remote repository.
- Syncs Docker template files from
clivewalkden/magento-docker-templates - Full container lifecycle management (start, stop, restart, build, logs, etc.)
- Magento CLI wrappers (cache management, n98-magerun, ece-patches)
- Frontend build tooling (composer, npm, node, grunt, Hyva/Tailwind)
- Database download, export, and import for Magento and WordPress
- Media sync via rsync from remote servers
- File copy between host and container via
docker cp - Environment setup orchestration (domains, SSL, RabbitMQ, Elasticsearch, WordPress)
- WordPress CLI passthrough
- Dry-run mode for template sync
- Go 1.23+
- Docker with the Compose plugin
- A
docker-sync.yamlconfig file in your project root (see Configuration)
brew install clivewalkden/taps/anvilgit clone git@github.com:clivewalkden/go-sozo-magento-docker-manager.git
cd go-sozo-magento-docker-manager
make buildThe compiled binary is written to bin/.
anvil [--verbose|-v] [--version|-V] <command>Use -v, -vv, or -vvv to increase log verbosity. All commands inherit these flags.
Syncs Docker template files from the remote template repository into the current project. Skips files listed in .anvilignore. Use --force to overwrite add-only files.
anvil sync
anvil sync --forceanvil docker start # docker compose up -d
anvil docker start --build # Rebuild images before starting
anvil docker start --remove-orphans # Remove orphaned containers on start
anvil docker stop # docker compose stop
anvil docker stop --optimise # Optimise (clear cache, DB, logs) then stop
anvil docker restart # Stop then start
anvil docker build # Rebuild images without cache
anvil docker status # docker compose ps
anvil docker check # docker compose config (validate)
anvil docker cleanup # docker compose down --volumes
anvil docker optimise # Clear image cache, optimise DB, truncate logs
anvil docker logs # Follow all service logs
anvil docker logs <service> # Follow a specific service's logsRuns a command inside the fpm container. All arguments after any flags are passed through to the container.
anvil docker cli bash # Open a bash shell
anvil docker cli bin/magento cache:status # Run any command
anvil docker cli --user root bash # Run as root
anvil docker cli --no-tty ls /app # No pseudo-TTY (-T)
anvil docker cli --user root --no-tty chmod +x /app/bin/magento
anvil docker cli --container db mysql -u root # Target a different container| Flag | Default | Description |
|---|---|---|
--user / -u |
www-data |
Container user to run as |
--container / -c |
fpm |
Target container |
--no-tty / -T |
false |
Disable pseudo-TTY (for scripting) |
anvil magento run <args> # bin/magento <args>
anvil magento n98 <args> # n98-magerun <args>
anvil magento ece-patches <args> # ece-patches <args>anvil magento cache clear # cache:clear
anvil magento cache clean # cache:clean
anvil magento cache flush # cache:flush
anvil magento cache enable # cache:enable
anvil magento cache disable # cache:disable
anvil magento cache status # cache:statusAll commands run inside the fpm container as www-data.
anvil build composer <args> # composer <args>
anvil build npm <args> # npm <args>
anvil build node <args> # node <args>
anvil build grunt <args> # Deletes pub/static, then npx grunt <args>
anvil build compile-hyva <args> # npm run <args> inside TAILWIND_DIR
anvil build setup-hyva # rm node_modules + npm install in TAILWIND_DIR
anvil build setup-frontend # Full grunt/npm frontend setupsetup-frontend queries the active Magento theme from the database and runs the full npm install + grunt compilation pipeline.
compile-hyva and setup-hyva require TAILWIND_DIR to be set in .docker/config.env.
# Download from remote server (SSH + SCP)
anvil db download # Interactive: prompt for Magento + WordPress
anvil db download --magento # Magento only
anvil db download --wordpress # WordPress only
anvil db download -y # Skip prompts
# Export from container
anvil db export # Interactive: prompt for Magento + WordPress
anvil db export --magento [file] # Magento only (default: m2.sql)
anvil db export --wordpress [file] # WordPress only (default: wp.sql)
anvil db export-table <table> # Export a single table
# Import into container
anvil db import # Interactive: prompt for Magento + WordPress
anvil db import --magento [file] # Magento only (default: /app/dev/m2.sql)
anvil db import --wordpress [file] # WordPress only (default: /app/dev/wp.sql)
anvil db import -y # Skip promptsDownload uses these env vars from .docker/config.env:
| Var | Purpose |
|---|---|
SSH_HOST |
Remote SSH host |
REMOTE_MAGENTO_DIR |
Remote Magento root |
REMOTE_PHP_BIN |
Remote PHP binary path |
REMOTE_N98_MAGERUN_BIN |
Remote n98-magerun binary path |
REMOTE_DB_BACKUP_DIR |
Remote directory for DB dumps |
REMOTE_WP_CLI_BIN |
Remote WP CLI binary (WordPress only) |
APP_SCHEMA |
URL scheme for domain replacement (default: https) |
LOCAL_DOMAINS |
Comma-separated local domains |
REMOTE_DOMAINS |
Comma-separated live domains (replaced in download) |
Magento import automatically runs setup:upgrade, indexer:reindex, and cache:flush after importing.
WordPress import performs domain search-replace via WP CLI using LOCAL_DOMAINS / REMOTE_DOMAINS.
WordPress commands require EnableWordpress: true in docker-sync.yaml.
anvil media import # Interactive: prompt for Magento + WordPress
anvil media import --magento # rsync Magento pub/media from remote
anvil media import --wordpress # rsync WordPress uploads from remote
anvil media import -y # Skip promptsUses SSH_HOST and REMOTE_SHARED_DIR from .docker/config.env. WordPress requires EnableWordpress: true.
anvil files pull <path> # Copy /app/<path> from container → magento/<path>
anvil files pull --all # Copy entire /app from container → magento/
anvil files push <path> # Copy magento/<path> from host → /app/<path>
anvil files push --all # Copy entire magento/ from host → /app/
anvil files push <path> -y # Skip permission-fix prompt after pushanvil setup run # Full setup orchestration (see below)
anvil setup run -y # Skip all interactive prompts
anvil setup domain # Add domains to /etc/hosts + set Magento base URLs
anvil setup ssl <domain> # Generate SSL cert and fetch from tls container
anvil setup ssl-ca # Install SOZO CA cert on macOS or Linux
anvil setup ssh # Copy SSH key into fpm container
anvil setup rabbitmq # Create magento RabbitMQ user, remove guest
anvil setup elasticsearch # Configure ES8 (indices.id_field_data.enabled)
anvil setup wordpress # Deploy FishPig theme + mu-plugins
anvil setup wordpress-local # Symlink wp-config, child theme, mu-pluginsRuns the complete setup sequence in order:
docker start --build --remove-orphans- Fix
magento/file permissions - Copy SSH key into container
composer install -ndb download(interactive)- Wait for SQL dump files to be present
db import(interactive)- Press Enter prompt before Magento setup commands
setup:upgrade→setup:static-content:deploy→indexer:reindex→cache:flushsetup wordpress(ifEnableWordpress: true)build setup-hyva+build compile-hyva build(ifTAILWIND_DIRis set), orbuild setup-frontendmedia import(interactive)setup domainsetup rabbitmqsetup elasticsearch(ifElasticSearchVersion >= 8.0.0)
anvil wordpress <args> # wp --path=/app/wp --color <args>Requires EnableWordpress: true in docker-sync.yaml. All arguments are passed directly to WP CLI inside the fpm container.
anvil system permissions # chmod 2666 (files) + 2777 (dirs) in magento/
anvil system elasticsearch <args> # docker compose exec elasticsearch <args>Create docker-sync.yaml in your project root. Example:
docker_template_version: "20250613"
elasticsearch_version: "8.7"
enable_kibana: false
enable_hyva: false
enable_varnish: false
enable_wordpress: true
enable_xdebug: false
hyva_theme_name: "clientname"
kibana_version: "8.11.4"
mysql_version: "8.0"
php_version: "8.2"
rabbitmq_version: "3.11"
redis_version: "7.0"
varnish_version: "6.0"
php_binary: "/usr/local/bin/php"
n98_binary: "/usr/local/bin/n98-magerun2"
wp_cli_binary: "/usr/local/bin/wp"| Flag | Effect |
|---|---|
enable_wordpress: true |
Enables anvil wordpress, anvil db *--wordpress, anvil media import --wordpress, anvil setup wordpress* |
elasticsearch_version: "8.x" |
anvil setup run calls anvil setup elasticsearch when version >= 8.0.0 |
hyva_theme_name |
Used by template rendering for Hyva/Tailwind setup |
Anvil loads environment variables at runtime from:
.docker/config.env— required; project-level variables.docker/local.env— optional; local overrides (gitignored)
USER_ID and GROUP_ID are set automatically from the current user.
MIT