-
Notifications
You must be signed in to change notification settings - Fork 4.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Container snapshots/restore feature and other critical bug fixes #6441
base: main
Are you sure you want to change the base?
Conversation
- Added sandbox.docker_snapshots config (bool) - Mounts a btrfs loop device for docker storage - Can be enabled/disabled (revert docker config change)
This is a great feature, thank you for working on it! It might be good to try to keep the bug fixes separate from new feature(s). One smaller fixes PR and one large feature PR would mean that the fixes PR is faster to review and merge. If you need the fixes too, you can create/rebase the feature branch on top on the fixes branch. It shouldn't cause much trouble when merged, then. Up to you, it just would be better IMHO. Because I think you are correct that the fixes are needed (independently), so it would be nice if we can take them in before the snapshots feature is ready. |
Here I isolated the critical bug fixes: |
PR Summary
This PR introduces several important fixes and features to enhance the overall functionality of the system.
Key Changes:
use_host_network = 1
.docker_runtime_kwargs = { privileged = true }
[Feature] Support running docker-in-docker for OpenHands runtime #5569
New Feature: Container Snapshot and Restore
This feature introduces the ability to snapshot and restore container storage. It mounts Docker's storage directory (
/var/lib/docker
) on a virtual Btrfs volume using a loop device within the OpenHands (OH) environment. This approach has been tested on Windows using VS Code and Dev Containers, with OH running in a Docker container and creating sandboxes in nested containers.Motivation:
The primary goal of this feature is to enable reverting changes made by OH across the entire system. This allows users to effectively undo any system modifications introduced during interactions within OH, promoting a safer and more predictable development and testing environment.
Important Notes:
Current Status:
Usage Instructions:
To enable the snapshot and restore functionality, add the following configuration to your sandbox settings:
If disabled, the Docker configuration will revert upon restarting OH.
Snapshot Creation:
Testing
openhands/storage/docker_snapshots.py
contains a test case (unit-tests in comments) to debug and understand how it works.Feel free to reach out if there are any issues or further questions.