copy -r into an existing directory consistent across backends
For a recursive copy whose destination is an existing directory, the rsync backend copied the *contents* of the source directory, while the scp backend copied the directory itself, like `cp -r` and `scp -r` do. Since `--backend=auto` prefers rsync and only falls back to scp when the guest has no rsync, the outcome of the very same command depended on the guest image. The rsync backend appended a trailing slash to every path of a recursive copy, and a trailing slash on the source is what tells rsync to copy the contents. Derive the form to pass to rsync from the destination instead, so that a trailing slash spelled by the user is no longer significant: - the destination is an existing directory: `SRC DST`, copying SRC into DST; - the destination does not exist yet: `SRC/ DST`, making DST a copy of SRC. A destination that can neither be confirmed nor ruled out to be a directory fails the copy, instead of being assumed to be missing, which would put the files in the wrong place again. This also fixes two related defects of the previous code: `copy -r` of a non-directory into a destination that does not exist made rsync fail on the appended slash, and multiple sources were merged into the destination instead of being copied by name. Add the missing case to copy.bats (both backends, both directions), which only covered a plain `SRC DST` copy into a destination that does not exist yet, plus unit tests for the path rewriting, which needs no VM. `limactl shell --sync` does want the form that copies the contents, so let it spell its own paths with a trailing slash and stop setting Options.Recursive, which for rsync only added a `-r` that `-a` already implies. Fixes #5500 Assisted-by: Claude Opus 5 (1M context) <noreply@anthropic.com> Signed-off-by: Akihiro Suda <akihiro.suda.cz@hco.ntt.co.jp>
[🌎Web site]
[📖Documentation]
[👤Slack (#lima)]
Lima: Linux Machines
Lima launches Linux virtual machines with automatic file sharing and port forwarding (similar to WSL2).
The original goal of Lima was to promote containerd including nerdctl (contaiNERD ctl) to Mac users, but Lima can be used for non-container applications as well.
Lima also supports other container engines (Docker, Podman, Kubernetes, etc.) and non-macOS hosts (Linux, NetBSD, etc.).
Getting started
Set up (Homebrew):
brew install lima
limactl start
To run Linux commands:
lima uname -a
To run containers with containerd:
lima nerdctl run --rm hello-world
To run containers with Docker:
limactl start template:docker
export DOCKER_HOST=$(limactl list docker --format 'unix://{{.Dir}}/sock/docker.sock')
docker run --rm hello-world
To run containers with Kubernetes:
limactl start template:k8s
export KUBECONFIG=$(limactl list k8s --format 'unix://{{.Dir}}/copied-from-guest/kubeconfig.yaml')
kubectl apply -f ...
See https://lima-vm.io/docs/ for the further information.
Contributing
We welcome contributions! Please see our Contributing Guide for details on:
- Developer Certificate of Origin (DCO): All commits must be signed off with
git commit -s - Code licensing and pull request guidelines
- Testing requirements
Community
Adopters
Container environments:
- Rancher Desktop: Kubernetes and container management to the desktop
- Colima: Docker (and Kubernetes) on macOS with minimal setup
- Finch: Finch is a command line client for local container development
- Podman Desktop: Podman Desktop GUI has a plug-in for Lima virtual machines
GUI:
- Lima xbar plugin: xbar plugin to start/stop VMs from the menu bar and see their running status.
- lima-gui: Qt GUI for Lima
Communication channels
- GitHub Discussions
#limachannel in the CNCF Slack- New account: https://slack.cncf.io/
- Login: https://cloud-native.slack.com/
- Community meetings on Zoom (tentatively monthly)
- Meeting notes & agenda proposals: https://github.com/lima-vm/lima/discussions/categories/meetings
- Calendar: https://zoom-lfx.platform.linuxfoundation.org/meetings/lima
Social media accounts
Follow us for project updates, release announcements, and community news:
Code of Conduct
Lima follows the CNCF Code of Conduct.
We are a Cloud Native Computing Foundation incubating project.
The Linux Foundation® (TLF) has registered trademarks and uses trademarks. For a list of TLF trademarks, see Trademark Usage.