BACK TO TEMPLATES
devopsany

Isolated Docker Container for AI Agent Execution

Multi-stage Dockerfile creating a secure, isolated sandbox runtime environment for AI agent execution.

When to use this

Use this Dockerfile template to spin up an isolated, non-root Linux sandbox container for autonomous AI code execution.

The template

# Multi-stage secure agent execution container
FROM node:20-alpine AS base

RUN apk add --no-libc git python3 make g++ bash curl

# Create non-root user
RUN addgroup -S agentgroup && adduser -S agentuser -G agentgroup

WORKDIR /home/agentuser/app
RUN chown -R agentuser:agentgroup /home/agentuser

USER agentuser

ENV NODE_ENV=development
ENV PAGER=cat

CMD ["tail", "-f", "/dev/null"]

How to use

Build with docker build -f Dockerfile.agent -t agent-sandbox . and mount project workspace under /home/agentuser/app.

Last verified 2026-07-26