Skip to content

feat: add Docker support#349

Open
Sun-ZhenXing wants to merge 8 commits intosuperradcompany:mainfrom
Sun-ZhenXing:feat-docker
Open

feat: add Docker support#349
Sun-ZhenXing wants to merge 8 commits intosuperradcompany:mainfrom
Sun-ZhenXing:feat-docker

Conversation

@Sun-ZhenXing
Copy link
Copy Markdown
Contributor

I've added a buildable Dockerfile that can be started directly with docker compose up -d.

Copilot AI review requested due to automatic review settings January 4, 2026 12:06
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR adds Docker support to microsandbox by introducing a Dockerfile and docker-compose.yaml configuration, enabling users to run the sandbox server via docker compose up -d. The implementation provides a containerized environment with configurable resources, automatic SDK image pulling, and necessary device access for KVM virtualization.

Key Changes

  • Added Dockerfile that builds a Debian-based image with microsandbox binaries for amd64 and arm64 architectures
  • Added docker-compose.yaml with service configuration including privileged mode, device mappings, volume management, and resource limits
  • Configured automatic pulling of Python and Node SDK images during build (optional via build arg)

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 10 comments.

File Description
Dockerfile Defines multi-architecture build process for microsandbox container image with dependency installation and SDK image pre-pulling
docker-compose.yaml Provides service configuration with environment variables, port mappings, volumes, device access, and resource constraints for running microsandbox

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@appcypher appcypher requested a review from toksdotdev January 5, 2026 00:34
Copy link
Copy Markdown
Member

@appcypher appcypher left a comment

Choose a reason for hiding this comment

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

Thanks for the contribution. I have some made come comments for changes and re-evaluation. Thanks again

@superradcompany superradcompany deleted a comment from Copilot AI Jan 11, 2026
@superradcompany superradcompany deleted a comment from Copilot AI Jan 11, 2026
@superradcompany superradcompany deleted a comment from Copilot AI Jan 11, 2026
Sun-ZhenXing and others added 4 commits January 17, 2026 14:01
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@Sun-ZhenXing
Copy link
Copy Markdown
Contributor Author

I made additional modifications to install_microsandbox.sh,
because shasum currently only supports Ubuntu, while sha256sum clearly offers better compatibility.

When using the installation script, I can only use sha256sum.

@appcypher
Copy link
Copy Markdown
Member

This looks good to me. I will need to setup a CI for the ghcr image release based of this branch. So it might take a bit.

Copy link
Copy Markdown

@Luukvdm Luukvdm left a comment

Choose a reason for hiding this comment

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

I wanted to run microsandbox in a docker container and used this branch and ran into a couple of bugs.

rm -rf /var/lib/apt/lists/*

# Download and install microsandbox binary
RUN VERSION ="${MICROSANDBOX_VERSION:-}" \
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Suggested change
RUN VERSION ="${MICROSANDBOX_VERSION:-}" \
RUN VERSION="${MICROSANDBOX_VERSION:-}" \

Comment on lines +26 to +35
command:
- /bin/sh
- -c
- >
if [ "${MICROSANDBOX_DEV_MODE:-true}" = "true" ]; then
DEV_FLAG="--dev";
else
DEV_FLAG="";
fi;
exec server start --host 0.0.0.0 --port ${MICROSANDBOX_PORT:-5555} ${DEV_FLAG};
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Suggested change
command:
- /bin/sh
- -c
- >
if [ "${MICROSANDBOX_DEV_MODE:-true}" = "true" ]; then
DEV_FLAG="--dev";
else
DEV_FLAG="";
fi;
exec server start --host 0.0.0.0 --port ${MICROSANDBOX_PORT:-5555} ${DEV_FLAG};
entrypoint: ["sh", "-c"]
command:
- |
DEV_FLAG=""
if [ "${MICROSANDBOX_DEV_MODE}" = "true" ]; then
DEV_FLAG="--dev"
fi
exec msb server start --host 0.0.0.0 --port ${MICROSANDBOX_PORT:-5555} $$DEV_FLAG

Main problem is that the DEV_FLAG variable needs to be escaped.
It would be cleaner to handle the entire dev mode stuff in the Dockerfile though.


# Download and install microsandbox binary
RUN VERSION ="${MICROSANDBOX_VERSION:-}" \
curl -fsSL https://raw.githubusercontent.com/zerocore-ai/microsandbox/refs/heads/main/scripts/install_microsandbox.sh | sh
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Would recommend to copy the source code and compile it in the docker build process. This makes releasing a lot easier.

Comment on lines +61 to +62
cd docker
docker-compose build
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Suggested change
cd docker
docker-compose build
docker compose -f docker/docker-compose.yaml build

More consistent with the other examples

@toksdotdev
Copy link
Copy Markdown
Member

toksdotdev commented Apr 1, 2026

@Sun-ZhenXing apologies for the delay in getting this merged in. given the recent changes (v0.3.7), it'd be nice if you could update this PR. thanks 🙏🏽

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.

5 participants