用途:在 Claude Code for Web 的受限容器环境中安装并运行 Docker,解决因 iptables 受限和代理拦截 HTTPS 而导致的构建失败。
环境识别:可按资料给出的方式判断所处环境,例如查看 $http_proxy、检测 /.dockerenv,或运行 iptables -L 看是否出现 Permission denied。
基本用法:安装并启动守护进程,需禁用 iptables 与 bridge,例如 sudo apt-get update && sudo apt-get install -y docker.io,随后 sudo dockerd --iptables=false --bridge=none &,等待后执行 docker info 验证。构建镜像时使用 csb build --host-network --insecure,其中 --host-network 改用主机网络,--insecure 为 curl 加 -k 并关闭 npm strict-ssl。创建沙箱使用 csb create my-sandbox --egress=all。
常见问题:出现 iptables 权限错误或 network bridge not found 时,重启 dockerd 并加 --iptables=false --bridge=none;出现 SSL 证书问题可用 curl -k 或 --insecure;npm 证书验证失败可临时 npm config set strict-ssl false,安装后建议重置为 true。清理时用 docker stop 停容器,再 sudo pkill dockerd 停守护进程。
限制:无 bridge 网络,容器共用主机网络;无法运行出口代理容器;构建必须关闭 SSL 验证;不支持 GPU 直通。未提供的功能与计费信息暂未提供。