mirror of
https://github.com/devvmhq/devvm.git
synced 2026-12-01 21:36:40 -10:00
devvm is about VMs, and Docker's containers aren't VMs: Lima is the default backend and smolvm stays experimental. The backend architecture (Backend, Caps, Require, the registry, backendtest.Fake) stays, so another backend is an addition. Removed: - internal/backend/docker, its registry entry and Names/Experimental's docker half; devvm _docker-connect and _docker-ports (internal/cli/dockerssh.go); assets/docker/unpack.sh. - Test-build overrides DEVVM_DOCKER_KIND, DEVVM_DOCKER_PROC_SYS, DEVVM_LINUX_BUILD_URL/_SHA256, the registry.linuxURL/linuxSHA256 ldflags vars and the CLI tests' Linux-build archive (linux_release). - Interfaces only Docker implemented, with their callers: backend.ProxySocket/ProxySocketOf (the proxy's -listen-unix), DiskUser (ls's and size's disk-over warning, size's disk_used and --json disk_used_gib), Reporter (doctor), LeftoverLister and Leftover (gc --orphans' volumes, networks, containers and images), DockerLayerVM and VMSpec.DockerLayer, SSHTarget.ProxyCommand and vmssh.SSH.Proxy, vmssh.SSH.SessionArgs, CacheEntry.Name. - The docker layer's runtime on a backend that makes VMs for it: vm/dockerlayer.go, KeyDockerLayer, chooseNet's refusal (chooseNet returns a bool now), the refusals at start and devvm network on, ls's "(sysbox)" and --json docker_layer, size_disk_default_unused. - The proxy's relay mode (relay.go, -relay, -relay-to, -listen-unix). - paths.Dirs.Docker and paths.VM.Lifeline. - assets/guest/tools.sh's linked-folder branch; services.sh's DEVVM_LOOP, DEVVM_DOCKERD and DEVVM_SSHD=inetd. - Messages: every docker_* the backend used, docker_layer_runtime, net_docker_layer, net_off_docker_layer, committing_image, pulling_image, unpacking_tools, disk_over, size_disk_default_unused, gc_orphan_volume/_network/_container/_image, docker_connect_failed; gc_orphan_elsewhere reworded. - Tests: docker.txtar, the docker stub's engine (its --from half stays), the ssh stub's login-shell branch; e2e's --backend docker, --engine, the docker host VM and Docker Desktop runs. - Release: one GoReleaser pass, no Linux-build pin in the macOS builds, no Linux devvm in the Homebrew formula's libexec. Linux builds stay. - Docs: backends/docker.md and internals/docker.md, design.md's Docker notes, the Docker column of the feature table, and every page's mentions of the Docker backend, Docker Desktop as one, and Sysbox. Kept: the docker layer in Lima VMs, devcontainer docker-in-docker, --from with images only a local Docker has, Docker Hub references. State written by a Docker VM before this reads as an unknown backend (backend_unknown_vm). Co-Authored-By: Claude Opus 5.5 <[email protected]>
30 lines
1.4 KiB
Bash
Executable File
30 lines
1.4 KiB
Bash
Executable File
#!/bin/bash
|
|
# Stand-in for docker in tests, for --from's images only Docker has. Logs every call to $STUB_LOG.
|
|
# `info` and `image inspect` fail when $STUB_DIR/docker-down exists. `image inspect --format {{.Id}}
|
|
# REF` finds an image only when $STUB_DIR/docker-image exists, and prints it (its ID). `save -o F
|
|
# REF` writes a tarball whose manifest.json names that
|
|
# image's config ($STUB_DIR/docker-saved instead, if it exists: the tag moved meanwhile). Anything
|
|
# else fails.
|
|
set -euo pipefail
|
|
"${0%/*}/stub-log" "$STUB_LOG" docker "$@"
|
|
case "${1:-} ${2:-}" in
|
|
"info "*)
|
|
[[ ! -e "$STUB_DIR/docker-down" ]] || { echo "failed to connect to the docker API" >&2; exit 1; }
|
|
exit 0 ;;
|
|
"image inspect")
|
|
[[ ! -e "$STUB_DIR/docker-down" ]] || { echo "failed to connect to the docker API" >&2; exit 1; }
|
|
[[ ${3:-} == --format && ${4:-} == '{{.Id}}' ]] || { echo "docker stub: image inspect $*" >&2; exit 2; }
|
|
[[ -f "$STUB_DIR/docker-image" ]] || { echo "Error response from daemon: No such image: ${5:-}" >&2; exit 1; }
|
|
cat "$STUB_DIR/docker-image"
|
|
exit 0 ;;
|
|
"save -o")
|
|
id=$(cat "$STUB_DIR/docker-saved" 2>/dev/null || cat "$STUB_DIR/docker-image")
|
|
d=$(mktemp -d)
|
|
printf '[{"Config":"blobs/sha256/%s","RepoTags":["%s"],"Layers":[]}]' "${id#sha256:}" "$4" > "$d/manifest.json"
|
|
tar -cf "$3" -C "$d" manifest.json
|
|
rm -rf "$d"
|
|
exit 0 ;;
|
|
esac
|
|
echo "docker stub: $*" >&2
|
|
exit 2
|