8000 adapt the project to use Docker-In-Docker · Issue #149 · stratum-mining/sv2-ui · GitHub
[go: up one dir, main page]

Skip to content

adapt the project to use Docker-In-Docker #149

Closed

Description

@lucasbalieiro

@GitGab19 identified a limitation on our side: we currently rely on Docker IPC communication to manage some containers, but this approach is not compatible with the Umbrel environment.

After discussing the issue with people on the Umbrel Discord, the conclusion was that Docker-in-Docker (DinD) is likely the best approach for this scenario.

This issue aims to investigate that possibility and adapt our application where necessary.

Another important question is whether Docker-in-Docker can fully replace our current setup, including for users outside the Umbrel platform. If not, we may need to maintain both approaches, which would add complexity and is probably not ideal long term.

Also, this could be an effort to mitigate the security implications raised by #134

for reference:
#131 (comment)

Activity

  1. GitGab19 commented on May 12, 2026

    @GitGab19
    Member

    Another important question is whether Docker-in-Docker can fully replace our current setup, including for users outside the Umbrel platform. If not, we may need to maintain both approaches, which would add complexity and is probably not ideal long term.

    I think we should unify the setup for both deployments, we don't have to be attached to the current docker run .. command we are showing to users on our website.

    The best approach is probably to have the docker-compose.yml in both cases: in case of users running it outside Umbrel, we can eventually simplify the UX by having an installer script, similarly to curl -fsSL https://fleet.proto.xyz/install.sh.

  2. moved this from Todo 📝 to In Progress 🏗️ in Stratum V2 - 2026 Q4 - Roadmap 📍🗺️on May 13, 2026
  3. moved this from Todo 📝 to In Progress 🏗️ in sv2-ui 👁️on May 13, 2026
  4. GitGab19 commented on May 21, 2026

    @GitGab19
    Member

    As discussed with @lucasbalieiro during yesterday's PR Review Club call, we will work on adding the docker-compose.yml in this repo in our next milestone.

    The reason is that we want to keep things stable for now, and the changes needed for that to happen are not super trivial.

    We also agreed on the possibility of having a simple setup script to mention in the website, instead of having users to clone, enter, and run the docker-compose commands.

  5. moved this from In Progress 🏗️ to Todo 📝 in Stratum V2 - 2026 Q4 - Roadmap 📍🗺️on Jun 19, 2026
  6. lucasbalieiro commented on Jun 23, 2026

    @lucasbalieiro
    CollaboratorAuthor

    Yesterday I experimented with the Docker REST API (https://docs.docker.com/reference/api/engine/version/v1.54/) to evaluate whether it could remove the need for direct access to docker.sock and provide a cleaner abstraction.

    Key conclusions from this exploration:

    The REST API does not remove the dependency on docker.sock. It is simply another interface over the same underlying socket, functionally equivalent to libraries like dockerode in our stack.

    For example, we can interact directly with the Docker daemon via the socket:

    curl --unix-socket /var/run/docker.sock \
      -H "Content-Type: application/json" \
      -d '{"Image": "alpine", "Cmd": ["echo", "hello world"]}' \
      -X POST http://localhost/v1.54/containers/create

    In practice, this still requires mounting docker.sock, and it does not provide additional isolation or permission granularity. It is essentially a different wrapper over the same backend. The Docker Engine does not expose a TCP port by default, which is why the Unix socket is required. Enabling TCP access would remove the need for --unix-socket /var/run/docker.sock, but it requires manual configuration changes, degrades UX, and exposes the API over the network, which increases the attack surface.

    Docker Desktop follows the same model: it is a client layered on top of the Docker API.

    I also tested Docker-in-Docker (DinD) as an alternative isolation strategy. It does not materially improve security. The container still requires --privileged mode, which effectively grants host-level control. In failure scenarios, isolation is limited: DinD may prevent direct impact on host containers, but any escape from the privileged environment is equivalent to full access via docker.sock.

    There are also compatibility concerns. It is unclear how a privileged DinD setup behaves across Windows and macOS. Docker documentation primarily focuses on Linux capabilities (https://docs.docker.com/engine/containers/run/#runtime-privilege-and-linux-capabilities), and our testing so far has been limited to Linux (in the context of Umbrel packaging).

    At this point, this feels misaligned with Docker’s security model. Docker is not designed for fine-grained permissions: access is effectively binary, either full control via the socket or no access at all.

    From what I could grasp, most systems requiring similar container control use an agent-based architecture: a privileged daemon interacts with docker.sock, while clients communicate with that daemon. We already partially follow this model by restricting Docker access to our backend service and avoiding direct host interaction elsewhere.

    From a UX perspective, the main concern is transparency around exposing docker.sock. However, this tradeoff is unavoidable if we want to manage containers. DinD with --privileged carries comparable risk. If a user is not comfortable exposing docker.sock, they are likely also not comfortable with a privileged DinD runtime. In that case, the current sv2-apps model, where users run and manage everything manually, remains the safest option.

    A simpler approach may be preferable:

    • Automatically detect and use docker.sock when available
    • Hide this configuration step in most cases
    • Clearly document that docker.sock access is required, including its implications

    Finally, beyond security and compatibility concerns, DinD increases system complexity and makes debugging harder due to additional layers of indirection when users report issues.

    DinD remains a possible direction, but these trade-offs should be explicitly evaluated before moving forward.

  7. GitGab19 commented on Jun 24, 2026

    @GitGab19
    Member

    Thanks for your investigation @lucasbalieiro, it's very exhaustive!

    It seems very clear to me that using DinD with --priviledged wouldn't add a real security improvement at this point.

    The only real hardening would be using the agent-based architecture you mentioned, with a defined set of APIs to do only specific operations on the containers.

    So for now I would not change anything tbh, expect for documenting the need for the docker socket more clearly on our website and docs.

    Maybe we can consider the work related to the agent-based architecture in the future, wdyt @lucasbalieiro ?

  8. lucasbalieiro commented on Jun 25, 2026

    @lucasbalieiro
    CollaboratorAuthor

    Maybe we can consider the work related to the agent-based architecture in the future, wdyt @lucasbalieiro ?

    yes, it could make it easier for security conscious users who are new to the project to review a smaller codebase focused solely on managing Docker lifecycles. Today, they would need to review docker.ts, but I'm not entirely sure all Docker related logic is centralized there.

  9. GitGab19 commented on Jun 25, 2026

    @GitGab19
    Member

    Can you open an issue about the agent-based architecture?

    So that we can keep tracking that idea in the future, and close this issue for now.

  10. lucasbalieiro commented on Jun 25, 2026

    @lucasbalieiro
    CollaboratorAuthor

    see: #196

  11. GitGab19 commented on Jun 25, 2026

    @GitGab19
    Member

    Great, thanks man.

  12. moved this from In Progress 🏗️ to Done ✅ in sv2-ui 👁️on Jun 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

Relationships

None yet

Development

No branches or pull requests

Issue actions

0