能否在现有Drupal开发的docker-compose环境中集成Eclipse Che?
Great question—let’s clear up the confusion and walk through how this works.
Short Answer
Yes, you can absolutely use Eclipse Che with your existing Docker Compose Drupal environment. Your initial thought about Che’s "exclusive stacks" is partially right (Che does offer pre-built stacks for quick setup), but those are optional—Che is designed to work with custom, existing containerized environments like yours.
How to Make It Work
There are two primary approaches to integrate Che with your setup:
1. Import Your Docker Compose File Directly into Che
Che supports importing existing docker-compose.yml files to create a new workspace. Here’s how to do it:
- Open Eclipse Che, start creating a new workspace, and select the "Import from Docker Compose" option.
- Upload your existing
docker-compose.ymlfile. Che will automatically parse the services (PHP, MySQL, Apache, etc.) and set them up as part of the workspace. - Minor adjustments you might need:
- Ensure your code volume mounts are configured so Che’s IDE can access the Drupal codebase (match the path in your containers to Che’s default workspace directory, or specify a custom path).
- Update Xdebug settings in your PHP container: set
xdebug.client_hostto the service name or IP of Che’s IDE container (or use Docker’s internal DNS to reference it) so debug requests reach Che’s debugging tools. - Verify network settings: make sure Che’s workspace network is connected to your existing Docker Compose network (or merge them) so services like Apache/MySQL are accessible from Che.
2. Attach Che to Your Already Running Docker Compose Containers
If your Drupal environment is already up and running, you can connect Che directly to those containers:
- In Che, configure a connection to your local Docker daemon (or remote daemon if your environment is hosted).
- Create a new workspace, then add your running PHP/Apache/MySQL containers as "existing containers" to the workspace.
- Map your code volume to Che’s IDE workspace directory so edits in Che sync with the container’s codebase.
- Configure Che’s terminal to connect directly to your PHP container, so you can run Drush commands, Behat tests, and interact with the environment just like you would locally.
Key Clarification on Che’s Stacks
Che’s pre-built stacks are just starting points for common languages/frameworks—they’re not a requirement. The tool’s core strength is its flexibility to adapt to existing containerized workflows. You don’t need to rebuild your entire Drupal environment to use Che; you’re just adding Che’s IDE layer on top of what you already have.
Quick Tips for Smooth Integration
- Resource Allocation: Che adds a few sidecar containers for IDE functionality, so make sure your machine has enough CPU/RAM to run both your existing environment and Che.
- Port Conflicts: Double-check that ports used by Che (like the IDE web interface, debugging ports) don’t clash with your existing Drupal services.
- Test Debugging: After setup, run a quick Xdebug test to confirm breakpoints trigger in Che when you access your Drupal site.
内容的提问来源于stack exchange,提问作者Francesco

