如何实现Eclipse RCP应用在Docker中运行?可通过Eclipse Che插件吗?
Great question! Let’s break this down into two key areas: getting your Eclipse RCP app up and running in Docker, and figuring out the best way to integrate it with Eclipse Che—whether that means contributing a plugin or taking a simpler route.
Containerizing an RCP app is totally doable, and it’s the first step if you want to integrate with Che later. Here’s a practical breakdown:
- Pick a lightweight base image: Start with something like
eclipse-temurin:17-jre(since RCP runs on Java) orubuntu:22.04—avoid heavy images to keep your container slim and fast. - Package your RCP app first: Use Eclipse PDE’s export wizard (or Maven/Tycho for automated builds) to create a standalone build of your RCP app. You’ll end up with a directory containing all binaries, a bundled JRE (if you chose that option), and launch scripts.
- Write a simple Dockerfile: Here’s a minimal example to get you started:
FROM eclipse-temurin:17-jre WORKDIR /app # Copy your exported RCP build into the container COPY ./path-to-your-rcp-build /app # Set the entrypoint to launch your app ENTRYPOINT ["./your-rcp-app-launch-script"] - Handle GUI (if your app needs it): If your RCP app has a graphical interface, you’ll need to pass your host’s X11 socket to the container to display the UI. Run the container with this command:
Headless RCP apps skip this part entirely—way simpler!docker run -it --rm -e DISPLAY=$DISPLAY -v /tmp/.X11-unix:/tmp/.X11-unix your-rcp-image-name - Automate builds: Use Docker Compose or a CI/CD pipeline (like GitHub Actions) to build and push your image automatically whenever you update your RCP app. This saves you from manual builds every time.
Now, let’s talk about Che integration. You’ve got two main paths here: building a custom plugin, or using simpler workarounds that don’t require contributing code.
Option 1: Contribute a Plugin to Eclipse Che
If you want deep, seamless integration (like one-click launches from Che’s UI, debugging support, or custom tooling), building a Che plugin is the way to go. Che uses Theia-based extensions and Dockerized plugins to add custom runtime support. Here’s what you need to know:
- Che plugins combine runtime + UI: You’ll need to create a Devfile that defines how to build/run your RCP app in a Che workspace, and optionally a Theia extension if you want custom UI controls (like a launch button in Che’s sidebar).
- Steps to get started:
- Learn the basics of Che’s Devfile format and Theia extension development (focus on workspace and runtime APIs).
- Build a Devfile that pulls your RCP Docker image, sets up environment variables, and defines launch commands.
- If you need UI integration, write a lightweight Theia extension that connects to Che’s workspace API to trigger your RCP app.
- Package your plugin as a Docker image, test it in a local Che instance, then submit it to the Eclipse Che plugin registry if you want to share it publicly.
- Who this is for: This makes sense if you or your team use Che daily and want a polished, integrated experience. It’s a bit more work upfront, but pays off for regular use.
Option 2: Simpler Alternatives (No Plugin Required)
If building a plugin feels like overkill, there are faster ways to use your RCP app with Che:
- Use a custom Devfile: Define a Devfile that imports your pre-built RCP Docker image into a Che workspace. Add commands to launch the app (including GUI forwarding if needed) and run them directly from Che’s terminal or command palette.
- Headless RCP as a service: If your RCP app runs in headless mode (e.g., as a backend service), expose its ports in your Docker image and configure Che to forward those ports. You can access the service via Che’s preview feature or your local machine.
- Run Docker commands directly in Che’s terminal: Just use Che’s built-in terminal to run your existing Docker commands (like
docker run ...)—this is the quickest way to get started, no extra setup required.
- Start small: Get your RCP app running in Docker first. That’s the foundation for any Che integration.
- If you only need occasional access to your RCP app in Che, go with the custom Devfile or terminal approach. It’s fast and low-effort.
- If you’re part of a team that relies on Che daily and wants tight integration, invest time in building a plugin. Contributing it to the Che community is also a great way to give back!
内容的提问来源于stack exchange,提问作者Alok

