A Dokku plugin for importing and managing Docker Compose files in Dokku.
- Docker Compose Support: Full support for Docker Compose v2 and v3 files
- Service Discovery: Automatically detects and imports all services from your compose file
- Dependency Resolution: Handles service dependencies and deploys in the correct order
- Plugin Integration: Automatically detects and configures Dokku plugins for known services (PostgreSQL, Redis, etc.)
- Resource Mapping: Converts Docker Compose resources to Dokku equivalents:
- Services → Dokku apps
- Environment variables → Dokku config
- Volumes → Dokku storage
- Ports → Dokku proxy settings
- Dry Run Mode: Preview changes before applying them
- Logging: Comprehensive logging with multiple verbosity levels
- Dokku 0.30.0 or later
yq
(for YAML parsing) - install with your package manager:# Ubuntu/Debian sudo apt-get install yq # RHEL/CentOS sudo dnf install yq # macOS (Homebrew) brew install yq
# Install from GitHub
dokku plugin:install https://github.com/deanmarano/dokku-docker-compose.git docker-compose
# Import default docker-compose.yml in current directory
dokku docker-compose:import
# Specify a custom compose file
dokku docker-compose:import -f docker-compose.prod.yml
# Specify a project name (prefix for all created resources)
dokku docker-compose:import -p myproject
# Dry run (show what would be done without making changes)
dokku docker-compose:import --dry-run
# Show verbose output
dokku docker-compose:import -v
# Show help
dokku docker-compose:help
# Show version information
dokku docker-compose:version
# Install the plugin (if not installed via git)
dokku docker-compose:plugin:install
# Uninstall the plugin
dokku docker-compose:plugin:uninstall
The plugin parses your Docker Compose file and maps the services to Dokku resources:
- Services are converted to Dokku apps
- Environment variables are set using
dokku config:set
- Volumes are created using Dokku's storage management
- Ports are configured using Dokku's proxy settings
- Dependencies between services are resolved and deployed in the correct order
- Plugins are automatically detected and configured for known services
- Service definitions
- Environment variables
- Volumes (named, anonymous, and host paths)
- Port mappings
- Service dependencies
- Networks (basic support)
- Build contexts
- Healthchecks
- Resource limits
- Secrets
The plugin automatically detects and configures Dokku plugins for these services:
- PostgreSQL (
postgres
) - MySQL (
mysql
) - MariaDB (
mariadb
) - Redis (
redis
) - Memcached (
memcached
) - MongoDB (
mongodb
) - And more...
# docker-compose.yml
version: '3.8'
services:
web:
image: nginx:alpine
ports:
- "80:80"
environment:
- DEBUG=true
depends_on:
- db
db:
image: postgres:13
environment:
POSTGRES_PASSWORD: example
Running dokku docker-compose:import
will:
- Create a Dokku app for the
web
service - Create a PostgreSQL service for the
db
service - Link the PostgreSQL service to the web app
- Configure the web app with the specified environment variables and ports
- Bash 4.0 or later
- Docker
- Docker Compose
- yq (for YAML parsing)
- BATS (for testing)
# Install test dependencies
bats --version || (echo "Installing BATS..." && git clone https://github.com/bats-core/bats-core.git && cd bats-core && sudo ./install.sh /usr/local)
# Run all tests
make test
# Run a specific test file
bats tests/parser.bats
You can configure the plugin using environment variables:
# Set log level (debug, info, warn, error, fatal)
export DOKKU_DOCKER_COMPOSE_LOG_LEVEL=info
# Set maximum number of retries for operations
export DOKKU_DOCKER_COMPOSE_MAX_RETRIES=3
# Set timeout in seconds for operations
export DOKKU_DOCKER_COMPOSE_TIMEOUT=300
MIT
- Fork the repository
- Create a new branch for your feature
- Commit your changes
- Push to the branch
- Create a new Pull Request
Dean Marano