cd /news/developer-tools/reproducing-the-devcontainer-dx-but-… Β· home β€Ί topics β€Ί developer-tools β€Ί article
[ARTICLE Β· art-151767] src=k33g.org β†— pub= topic=developer-tools verified=true sentiment=↑ positive

Reproducing the devcontainer DX, but securely

Docker's sbx sandboxes can now be connected to VS Code over SSH, letting developers compile and run code inside an isolated microVM with secrets protection and network policies instead of on the host machine, according to a Docker documentation-based walkthrough. The setup uses sbx kits β€” declarative YAML configurations β€” plus the `sbx setup ssh` command, which adds a `*.sbx` block to `~/.ssh/config`, and the `sbx env create` and `sbx env rm` commands to manage the environment. The example `vscode-ssh` kit (version 0.1.0, MIT licensed) builds on the `docker/sandbox-templates:shell` image, installs VS Code Remote-SSH server dependencies, and restricts network access to VS Code update and marketplace domains.

read7 min views1 publishedOct 17, 2026
Reproducing the devcontainer DX, but securely
Image: K33G (auto-discovered)

I have always loved using devcontainer, because it lets VS Code open a project in a preconfigured container with its tools, dependencies and extensions, so you can start coding right away in a reproducible environment without installing everything on your machine. devcontainer connects VS Code to the container, so you keep your usual editor while using the container's tools and dependencies for the terminal, autocompletion, tests and debugging: you develop in the same environment as the one where the code runs.

Today, with sbx and its SSH access feature, you can absolutely connect VS Code to a running sbx sandbox over SSH. Your code is then compiled and executed inside this isolated environment, rather than on your host machine. You get a setup similar to what devcontainer offers, but with the security hardening tools of sbx such as the microVM, secrets protection and network policies.

Let's see how to put this into practice with sbx kits, and make it all smooth and straightforward thanks to the sbx env create and sbx env rm commands.

Docker sbx kits are declarative YAML configurations that define sandboxes and enrich them with network policies, environment variables, commands ...

Prerequisites #

First of all, you need VS Code installed. Then, you need to install the Remote-SSH extension in VS Code (only once):

code --install-extension ms-vscode-remote.remote-ssh

Then, you need to add the *.sbx block to ~/.ssh/config (idempotent):

sbx setup ssh

Creating the vscode-ssh kit #

vscode-ssh kit In a folder, create a tree like this one:

.
β”œβ”€β”€ demo
β”‚   └── README.md
β”œβ”€β”€ kits
β”‚   └── vscode-ssh
β”‚       β”œβ”€β”€ config
β”‚       β”‚   └── machine-settings.json
β”‚       β”œβ”€β”€ kit.dockerfile
β”‚       └── kit.yaml
└── sbxenv.yaml
  • The demo folder will be the VS Codeworkspace (this is where you can create the.vscode folder with theextensions.json andsettings.json files)
  • The kits folder will contain all the kits needed to build our secure working environment.
  • The sbxenv.yaml file will let us manage the environment of oursbx sandbox (think of it as the compose file ofsbx )

vscode-ssh

vscode-ssh The kit is made of the following 3 files:

vscode-ssh/config/machine-settings.json:

{
    "telemetry.telemetryLevel": "off",
    "update.mode": "none",
    "extensions.autoUpdate": false,
    "terminal.integrated.defaultProfile.linux": "bash"
}

vscode-ssh/kit.dockerfile:

FROM docker/sandbox-templates:shell

USER root

RUN <<EOF
set -eux
apt-get update
DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
  libstdc++6 tar gzip curl wget ca-certificates procps git
rm -rf /var/lib/apt/lists/*
EOF

USER agent

RUN --mount=type=bind,target=/tmp/kit <<EOF
set -eux
install -D -m 0644 /tmp/kit/config/machine-settings.json \
  /home/agent/.vscode-server/data/Machine/settings.json
EOF

WORKDIR /home/agent/workspace

vscode-ssh/kit.yaml:

schemaVersion: "3"
kind: workload
displayName: vscode-ssh
description: >-
    Shell sandbox for VS Code Remote-SSH
sourceUrl: https://rickub.com/k33g/devsbx
licenses: [MIT]
version: "0.1.0"
capabilities:
    - type: com.docker.sandbox/sbx@1
    - type: com.docker.sandbox/network-policy@1
      config:
        runtime:
            allow:
                - update.code.visualstudio.com
                - vscode.download.prss.microsoft.com
                - "*.vscode-cdn.net"
                - marketplace.visualstudio.com
                - "*.gallery.vsassets.io"
                - "*.gallerycdn.vsassets.io"
                - open-vsx.org

sbxenv.yaml #

sbxenv.yaml sbxenv.yaml is a declarative configuration file that describes a Docker Sandboxes environment (AI agent, mounted folders, variables, secrets and tools) so you can create and manage it with the sbx env commands.

schemaVersion: "1"

name: vscode-demo

agent: vscode-ssh

kits:
  - ./kits/vscode-ssh

workspace: ./demo

So let's see how to launch our new development environment.

Starting the secure development environment #

First, you need to create and start the sbx sandbox with the following command:

sbx env create --force

--force skips the confirmation messages

And once the sbx sandbox is created, you can start VS Code with the command below to connect it to the sandbox over SSH:

code --new-window --remote ssh-remote+vscode-demo.sbx "$PWD/demo"

Note: in ssh-remote+vscode-demo.sbx we reuse the sandbox name defined in sbxenv.yaml: name: vscode-demo

And VS Code will start in the demo folder and initialize the connection to the vscode-demo sandbox:

But now it would be nice to add a few tools, like a Rust toolchain for example. So we are going to create a second type of kit, a mixin kit, to install Rust in our environment.

Adding Rust to our working environment #

First, let's stop and remove the running sbx instance with the command:

sbx env rm --force

And let's create a new rust-toolchain kit in the ./kits folder:

.
β”œβ”€β”€ demo
β”‚   └── README.md
β”œβ”€β”€ kits
β”‚   β”œβ”€β”€ rust-toolchain
β”‚   β”‚   β”œβ”€β”€ rust-toolchain.dockerfile
β”‚   β”‚   └── rust-toolchain.yaml
β”‚   └── vscode-ssh
β”‚       β”œβ”€β”€ config
β”‚       β”‚   └── machine-settings.json
β”‚       β”œβ”€β”€ kit.dockerfile
β”‚       └── kit.yaml
└── sbxenv.yaml

Now, let's have a look at the contents of rust-toolchain.dockerfile and rust-toolchain.yaml.

rust-toolchain/rust-toolchain.dockerfile:


FROM debian:trixie-slim AS rust
ARG RUST_VERSION

RUN <<EOF
set -eu
apt-get update
apt-get install -y --no-install-recommends curl ca-certificates
rm -rf /var/lib/apt/lists/*
EOF

ENV RUSTUP_HOME=/usr/local/rustup \
    CARGO_HOME=/usr/local/cargo
RUN <<EOF
set -eu
curl -fsSL https://sh.rustup.rs | sh -s -- -y --no-modify-path \
  --profile minimal \
  --default-toolchain "${RUST_VERSION}" \
  --component rustfmt,clippy,rust-analyzer,rust-src
EOF

RUN <<EOF
set -eu
toolchain="$(ls -d /usr/local/rustup/toolchains/*)"
mkdir -p /out/usr/local/bin
for bin in cargo rustc rustdoc rustfmt cargo-fmt cargo-clippy clippy-driver rust-analyzer; do
  ln -s "${toolchain}/bin/${bin}" "/out/usr/local/bin/${bin}"
done
mkdir -p /out/usr/local/rustup/toolchains
mv "${toolchain}" /out/usr/local/rustup/toolchains/
EOF

FROM docker/sandbox-templates:shell AS linker
USER root
RUN <<EOF
set -eu
apt-get update
apt-get install -y --no-install-recommends --download-only gcc libc6-dev
mkdir -p /out
for deb in /var/cache/apt/archives/*.deb; do
  dpkg-deb -x "${deb}" /out
done
ln -sf gcc /out/usr/bin/cc
rm -rf /out/usr/share/doc /out/usr/share/man /out/usr/share/info /out/usr/share/locale
EOF

FROM scratch
COPY --from=linker /out/ /
COPY --from=rust /out/ /

rust-toolchain/rust-toolchain.yaml:

schemaVersion: "3"
kind: mixin
displayName: Rust toolchain
description: Rust toolchain (cargo, rustc, rustfmt, clippy) and rust-analyzer (language server)

args:
  rust_version:
    default: "1.99.0"
    pattern: '^([0-9]+\.[0-9]+(\.[0-9]+)?|stable|beta|nightly)$'
    buildArg: RUST_VERSION

provides: ["rust@${{ kit.args.rust_version }}"]

capabilities:
  - type: com.docker.sandbox/network-policy@1
    config:
      runtime:
        allow:
          - index.crates.io
          - static.crates.io
          - crates.io
          - github.com

Then let's update sbxenv.yaml to add ./kits/rust-toolchain:

sbxenv.yaml:

schemaVersion: "1"

name: vscode-demo

agent: vscode-ssh

kits:
  - ./kits/vscode-ssh
  - ./kits/rust-toolchain

workspace: ./demo

And now all you have to do is run again:

sbx env create --force

Wait a few moments while the new kit builds.

Then, we can start VS Code:

code --new-window --remote ssh-remote+vscode-demo.sbx "$PWD/demo"

And you can check that Rust is properly installed:

And of course, you can absolutely add the AI agent of your choice to your setup.

Adding Claude Code #

So I added a claude-code kit of type mixin to my project. You can grab it here: sbx-vscode/kits/claude-code, and I added this line to the kits section in sbxenv.yaml:

- ./kits/claude-code

And once my sandbox is recreated, I can now use Claude Code:

Et voilΓ ! You now have everything you need to build yourself development environments that are secure for real.

Written by

Keep reading

Improving the Developer Experience with SBX Kits

Improve the developer experience with sbx kits: reusable sandbox customizations for Go, Node.js, and code-server extensions.

May 1, 2026

Embedding a Web IDE and Docker Agent into sbx, a fully secured sandbox

Embed a web IDE and docker-agent into an sbx sandbox with Docker Model Runner for a ready-to-use secure dev environment.

Apr 18, 2026

Running Mistral's Vibe CLI in an sbx sandbox

Run Mistral's Vibe coding agent CLI securely inside an sbx sandbox, with credential handling and network isolation.

Jun 9, 2026 From other blogs

── more in #developer-tools 4 stories Β· sorted by recency
── more on @docker 3 stories trending now
sponsored brought to you by zahid.host 4,200+ EU-deployed projects
reading about agents? ship yours in a single git push.

Run your AI side-project on zahid.host

EU-based hosting, git-push deploys, automatic HTTPS, no cold starts. Free tier with a custom domain β€” perfect for shipping the agent you just read about.

$git push zahid main
β†’ Live at https://your-agent.zahid.host βœ“
Get free account β†’ Pricing
from €0/mo Β· no card required
LIVE [news/reproducing-the-devc…] indexed:0 read:7min 2026-10-17 Β· β€”