colima icon indicating copy to clipboard operation
colima copied to clipboard

Clarify External Volume Support

Open kobys8 opened this issue 2 years ago • 2 comments

Description

When running a Colima instance using the Docker runtime, any mounts made do not map to external directories present on the host machine. It will create a blank or even a shadow copy of the directory structure but not contain/update any of the files expected on said host directory.

This issue persists the same way even when the command limactl edit colima is run and the external mount added, which seems to overwrite one of the default mounts as well, causing catastrophic issues to containers/projects already existing in colima.

Version

Colima Version: 0.4.6 Lima Version: 0.13.0 Qemu Version: 7.1.0

Operating System

  • [X] macOS Intel
  • [ ] macOS M1
  • [ ] Linux

Reproduction Steps

  1. Either using docker run or a Docker Compose project, add a volume mount that maps to an existing directory on the host machine.
  2. Make sure the mount is writable in limactl edit colima
  3. When attempting to access files in the now running Docker container, attempt to access the mounted directory.

Expected behaviour

The directory would contain the expected files and read/write to the actual directory on the host.

Additional context

This affects services like Nextcloud, calibre-web, and other services dependent on large amounts of storage that can’t solely be contained in a VM.

kobys8 avatar Nov 12 '22 19:11 kobys8

@kobys8 for frequent reads/writes, I would recommend using the 9p volume mount. It is slower but more reliable.

# delete current VM as it is better to start afresh with 9p,
# switching an existing VM to 9p may have undesired behaviour.
colima delete

# start with 9p mount
colima start --mount-type 9p

Switching to 9p as the default is being evaluated for the next release and the upstream project (Lima) is also planning the switch to 9p as default from v1.0.

abiosoft avatar Nov 13 '22 04:11 abiosoft

I have been trying to understand external volume support because I'm using Colima to run the SQL server images here mcr.microsoft.com/mssql/server:2022-preview-ubuntu-22.04

I have the same problem described above, but using 9p doesn't seem like an option because I also need to use rosetta.

I'm starting Colima with colima start --arch aarch64 --vm-type=vz --vz-rosetta -m 8 -c 4 --mount-type 9p but it says 9p is not supported.

Is there a workaround when using both Rosetta and wanting to access external drives?

benwhalley avatar Dec 20 '23 13:12 benwhalley