Repository navigation
Expand file tree
/
Copy pathDockerfile.sandbox-browser
More file actions
48 lines (40 loc) · 1.66 KB
/
Copy pathDockerfile.sandbox-browser
File metadata and controls
48 lines (40 loc) · 1.66 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
# Sandbox browser container for OpenClaw's browser tool.
# Provides headless Google Chrome with CDP exposed via socat proxy.
#
# OpenClaw launches this container with:
# --read-only --cap-drop ALL --security-opt no-new-privileges --user 0:0
# The only guaranteed writable path is /dev/shm (tmpfs), so we point all
# browser writable state there via /tmp and XDG dirs.
FROM debian:bookworm-slim
ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
ca-certificates \
curl \
gnupg \
wget \
socat \
fonts-liberation \
libnss3 \
libatk-bridge2.0-0 \
libgtk-3-0 \
libgbm1 \
libasound2 \
&& install -d -m 0755 /etc/apt/keyrings \
&& wget -qO- https://dl.google.com/linux/linux_signing_key.pub \
| gpg --dearmor -o /etc/apt/keyrings/google-chrome.gpg \
&& echo "deb [arch=amd64 signed-by=/etc/apt/keyrings/google-chrome.gpg] https://dl.google.com/linux/chrome/deb/ stable main" \
> /etc/apt/sources.list.d/google-chrome.list \
&& apt-get update \
&& apt-get install -y --no-install-recommends google-chrome-stable \
&& rm -rf /var/lib/apt/lists/*
# Redirect /tmp -> /dev/shm so that writes land on the always-writable tmpfs.
# OpenClaw mounts the container --read-only and suppresses VOLUME auto-creation,
# so /tmp is read-only at runtime. /dev/shm is the only guaranteed writable path.
RUN rm -rf /tmp && ln -s /dev/shm /tmp
COPY --chmod=755 scripts/sandbox-browser-entrypoint.sh /usr/local/bin/sandbox-browser-entrypoint
ENV OPENCLAW_BROWSER_NO_SANDBOX=1
RUN useradd --create-home --shell /bin/bash sandbox
USER sandbox
WORKDIR /home/sandbox
CMD ["sandbox-browser-entrypoint"]