Skip to content

feat(nodes): add Docker API backend#394

Open
ArshSSandhu wants to merge 18 commits into
mieweb:mainfrom
ArshSSandhu:375-docker-node-api
Open

feat(nodes): add Docker API backend#394
ArshSSandhu wants to merge 18 commits into
mieweb:mainfrom
ArshSSandhu:375-docker-node-api

Conversation

@ArshSSandhu

Copy link
Copy Markdown
Collaborator

Summary

Closes #375.

This PR adds support for Docker-backed nodes by introducing a new DockerApi implementation that follows the existing Node API contract used by ProxmoxApi and DummyApi.

Changes include:

  • Added DockerApi using Docker Engine's native HTTP API through axios
  • Added support for Docker host formats:
    • unix:///var/run/docker.sock
    • tcp://host:2375
    • http://...
    • https://...
  • Updated Node.api() to dispatch to DockerApi when nodeType === "docker"
  • Added provider-neutral API access checks through node.hasApiAccess()
  • Updated container provisioning node selection to use Node.provisionableWhere(...)
  • Added nodeType support to node API serialization, create, and update routes
  • Updated the node form UI to support Proxmox, Docker, and dummy nodes
  • Allowed Docker host values such as unix:///var/run/docker.sock in the frontend form

Related Issue

Closes #375

Testing

Tested locally with the following checks:

  • Ran backend syntax checks successfully:

    node --check create-a-container/models/node.js
    node --check create-a-container/utils/docker-api.js
    node --check create-a-container/utils/container-status.js
    node --check create-a-container/routers/api/v1/containers.js
    node --check create-a-container/routers/api/v1/nodes.js
  • Ran frontend type-check successfully:

    npm run client:type-check
  • Ran whitespace checks successfully:

    git diff --check
    git diff --cached --check
  • Tested DockerApi directly against local Docker using:

    unix:///var/run/docker.sock
  • Verified direct Docker lifecycle flow:

    • Pulled nginx:latest
    • Created a Docker container
    • Started the container
    • Checked running status
    • Deleted the test container
  • Verified the UI can create a Docker node with:

    Name: local-docker
    Node type: Docker
    Docker host: unix:///var/run/docker.sock
  • Attempted full UI container creation with nginx:latest. The job selected the Docker node and Docker image path correctly, but failed with:

    connect ENOENT /var/run/docker.sock

    This appears to be a local runtime/socket-mount limitation because the Manager runtime does not currently have the host Docker socket mounted. The DockerApi itself was verified successfully through the direct lifecycle test above.

Screenshots

Docker node form

image

Docker node created

image

Breaking Changes

None known.

Notes

Full end-to-end Docker provisioning from the UI requires the Manager runtime to have access to the configured Docker host. For local socket usage, /var/run/docker.sock must be mounted or otherwise reachable from the process running Manager.

@runleveldev runleveldev self-requested a review July 8, 2026 15:32

@runleveldev runleveldev left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The UI displays "Creds missing" for Docker nodes

Image

Running our default templates fail since they use SystemD. Similar to how Proxmox checks for "application containers" and make the nessecary adjustments, this needs to check for "system containers" and make the nessacary adjustments (such as setting privileged: true)

7a542e3b9e12   ghcr.io/mieweb/opensource-server/base:latest            "/sbin/init"             19 seconds ago   Exited (255) 17 seconds ago                hollow-urban-otter

Comment thread create-a-container/client/src/pages/nodes/NodeFormPage.tsx Outdated
Comment thread create-a-container/utils/docker-api.js Outdated
Comment thread create-a-container/utils/docker-api.js Outdated
Comment thread create-a-container/utils/docker-api.js Outdated
Comment thread create-a-container/utils/docker-api.js Outdated
Comment thread create-a-container/utils/docker-api.js
Comment thread create-a-container/utils/docker-api.js
Comment thread create-a-container/utils/docker-api.js
Comment thread create-a-container/utils/docker-api.js Outdated
Comment thread create-a-container/models/node.js Outdated
@ArshSSandhu

Copy link
Copy Markdown
Collaborator Author

The Docker credential badge was fixed in 15ffc48fix(nodes): handle Docker credential badge.

The systemd/default template handling was fixed in e3e9465fix(docker): support system containers.

I pushed the requested review fixes as separate commits so each item is easier to inspect.

Testing run:

  • backend node --check commands
  • frontend npm run type-check from create-a-container/client
  • git diff --check

I replied on the individual threads with the commit that addresses each item. I left the Docker real container ID thread unresolved because Containers.containerId is currently INTEGER.UNSIGNED, so using Docker’s real string/hash ID needs a schema decision.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Docker-type Node API

2 participants