跳到主要内容

Claude Cage · 面向 Claude 的隔离开发环境,支持桌面工作台、多账号、远程部署与移动端连接。上游 Lee-xeo/Claude-Cage 完整源码镜像,非灵栈原创;主许可 MIT,第三方组件遵循各自许可。来源:https://github.com/Lee-xeo/Claude-Cage 。手动同步,不附带 Release 安装包。

浏览文件

docker.yaml

98 行 · 3.7 KB历史下载
1# A template to use Docker instead of containerd & nerdctl
2# $ limactl start ./docker.yaml
3# $ limactl shell docker docker run -it -v $HOME:$HOME --rm alpine
4
5# To run `docker` on the host (assumes docker-cli is installed):
6# $ export DOCKER_HOST=$(limactl list docker --format 'unix://{{.Dir}}/sock/docker.sock')
7# $ docker ...
8
9minimumLimaVersion: 2.0.0
10
11base:
12- template:_images/ubuntu-lts
13- template:_default/mounts
14
15# containerd is managed by Docker, not by Lima, so the values are set to false here.
16containerd:
17 system: false
18 user: false
19provision:
20- mode: system
21 # This script defines the host.docker.internal hostname when hostResolver is disabled.
22 # It is also needed for lima 0.8.2 and earlier, which does not support hostResolver.hosts.
23 # Names defined in /etc/hosts inside the VM are not resolved inside containers when
24 # using the hostResolver; use hostResolver.hosts instead (requires lima 0.8.3 or later).
25 script: |
26 #!/bin/sh
27 sed -i 's/host.lima.internal.*/host.lima.internal host.docker.internal/' /etc/hosts
28- mode: system
29 script: |
30 #!/bin/bash
31 set -eux -o pipefail
32 command -v docker >/dev/null 2>&1 && exit 0
33 export DEBIAN_FRONTEND=noninteractive
34 curl -fsSL https://get.docker.com | sh
35 # NOTE: you may remove the lines below, if you prefer to use rootful docker, not rootless
36 systemctl disable --now docker.service docker.socket containerd.service containerd.socket || true
37 systemctl mask docker.service docker.socket containerd.service containerd.socket || true
38 apt-get install -y uidmap dbus-user-session
39- mode: yq
40 path: "{{.Home}}/.config/docker/daemon.json"
41 expression: |
42 .features.cdi = true |
43 .features.containerd-snapshotter = {{.Param.containerdSnapshotter}}
44 owner: "{{.User}}"
45- mode: user
46 script: |
47 #!/bin/bash
48 set -eux -o pipefail
49 systemctl --user start dbus
50 dockerd-rootless-setuptool.sh install
51 docker context use rootless
52probes:
53- script: |
54 #!/bin/bash
55 set -eux -o pipefail
56 if ! timeout 30s bash -c "until command -v docker >/dev/null 2>&1; do sleep 3; done"; then
57 echo >&2 "docker is not installed yet"
58 exit 1
59 fi
60 if ! timeout 30s bash -c "until pgrep rootlesskit; do sleep 3; done"; then
61 echo >&2 "rootlesskit (used by rootless docker) is not running"
62 exit 1
63 fi
64 hint: See "/var/log/cloud-init-output.log" in the guest
65hostResolver:
66 # hostResolver.hosts requires lima 0.8.3 or later. Names defined here will also
67 # resolve inside containers, and not just inside the VM itself.
68 hosts:
69 host.docker.internal: host.lima.internal
70portForwards:
71- guestSocket: "/run/user/{{.UID}}/docker.sock"
72 hostSocket: "{{.Dir}}/sock/docker.sock"
73message: |
74 To run `docker` on the host (assumes docker-cli is installed), run the following commands:
75 ------
76 docker context create lima-{{.Name}} --docker "host=unix://{{.Dir}}/sock/docker.sock"
77 docker context use lima-{{.Name}}
78 docker run hello-world
79 ------
80 {{- if .Instance.Config.VMOpts.vz.rosetta.enabled}}
81 Rosetta is enabled in this VM, so you can run x86_64 containers on Apple Silicon.
82 You can use Rosetta AOT Caching with the CDI spec:
83 - To run a container, add `--device=lima-vm.io/rosetta=cached` to your `docker run` command:
84 ------
85 docker run --platform=linux/amd64 --device=lima-vm.io/rosetta=cached ...
86 ------
87 - To build an image, add `# syntax=docker/dockerfile:1-labs` at the top of your Dockerfile,
88 and use `--device=lima-vm.io/rosetta=cached` in the `RUN` command:
89 ------
90 # syntax=docker/dockerfile:1-labs
91 FROM ...
92 ...
93 RUN --device=lima-vm.io/rosetta=cached <your amd64 command>
94 ------
95 See: https://lima-vm.io/docs/config/multi-arch/#rosetta-aot-caching
96 {{- end}}
97param:
98 containerdSnapshotter: true