Skip to content

feat(nodes): add Docker API backend#394

Merged
runleveldev merged 27 commits into
mieweb:mainfrom
ArshSSandhu:375-docker-node-api
Jul 21, 2026
Merged

feat(nodes): add Docker API backend#394
runleveldev merged 27 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.

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/routers/api/v1/nodes.js
@ArshSSandhu

ArshSSandhu commented Jul 17, 2026

Copy link
Copy Markdown
Collaborator Author

@runleveldev

I pushed the latest review fixes as separate commits:

  • 4b3f6bd — restored the pulled-image requirement
  • fdcbea8 — only ignore expected non-swarm network errors
  • ebb9fb2 — removed the image-name system-container heuristic
  • f886191 — updated OpenAPI for Docker node fields
  • e65f467 — migrated containerId to string-backed provider IDs
  • fcd4718 — addressed Docker containers by Docker's real container ID

I also ran the backend syntax checks, frontend type-check, and git diff --check.

@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.

@ArshSSandhu this was the only thing found in my final QA round. Once it's fixed I think this is ready to merge.

Comment thread create-a-container/utils/docker-api.js
@ArshSSandhu

Copy link
Copy Markdown
Collaborator Author

@runleveldev I fixed it, let me know if anything else is needed.

runleveldev
runleveldev previously approved these changes Jul 21, 2026

@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.

@ArshSSandhu I pushed one commit because it was such a small fix by the time I knew what the issue was I already had it fixed. I'm going to approve this, let me know that you've reviewed what I did then I'll merge.

@ArshSSandhu ArshSSandhu left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

@runleveldev I think this should compare String(r.vmid) === String(vmid) instead of strict equality, since containerId is now stored as a string but Proxmox snapshots may still return numeric VMIDs.

@runleveldev

Copy link
Copy Markdown
Collaborator

@runleveldev I think this should compare String(r.vmid) === String(vmid) instead of strict equality, since containerId is now stored as a string but Proxmox snapshots may still return numeric VMIDs.

Good catch. My commit fixed the issue for docker containers but just moved it to affecting Proxmox containers.

@ArshSSandhu

Copy link
Copy Markdown
Collaborator Author

@runleveldev I fixed it. This PR should be ready to merge.

@runleveldev
runleveldev self-requested a review July 21, 2026 18:57
@runleveldev
runleveldev merged commit 5325779 into mieweb:main Jul 21, 2026
5 of 6 checks passed
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