### Example implementation Source: https://github.com/abiosoft/colima/blob/main/_autodocs/extension-guide.md Example implementation of a model runner. ```go package custom import ( "context" ) type customModelRunner struct { // store dependencies } func (m *customModelRunner) Name() string { return "custom" } func (m *customModelRunner) Run(ctx context.Context, args ...string) error { // Execute model with custom arguments return nil } func NewCustomModelRunner() interface{} { // ModelRunner return &customModelRunner{} } ``` -------------------------------- ### Start() Method Example Source: https://github.com/abiosoft/colima/blob/main/_autodocs/app-interface.md Shows how to start a Colima instance with a specific configuration, including CPU, memory, disk size, and runtime. ```go app, _ := app.New() cfg := config.Config{ CPU: 4, Memory: 8, Disk: 100, Runtime: "docker", } if err := app.Start(cfg); err != nil { fmt.Println("Error starting:", err) } ``` -------------------------------- ### Starting an Instance Source: https://github.com/abiosoft/colima/blob/main/_autodocs/README.md Example command to start a Colima instance with specified resources, runtime, and Kubernetes enabled. ```bash colima start --cpus 4 --memory 8 --disk 100 --runtime docker --kubernetes ``` -------------------------------- ### Host() Method Example Source: https://github.com/abiosoft/colima/blob/main/_autodocs/environment-interfaces.md Example of how to use the Host() method to get host actions and run a command. ```go host := vm.Host() version, _ := host.RunOutput("qemu-system-x86_64", "--version") fmt.Println("QEMU version:", version) ``` -------------------------------- ### Unit Testing Source: https://github.com/abiosoft/colima/blob/main/_autodocs/extension-guide.md Example of a unit test for a custom runtime component. ```go func TestCustomRuntime(t *testing.T) { host := mockHost{} guest := mockGuest{} runtime := NewCustomRuntime(host, guest) if runtime.Name() != "custom" { t.Fatal("Name mismatch") } } ``` -------------------------------- ### Version Checking Source: https://github.com/abiosoft/colima/blob/main/_autodocs/extension-guide.md Example of retrieving the Colima application version. ```go cfg, _ := ctx.Value(config.CtxKey()).(config.Config) version := config.AppVersion() println(version.Version) // "0.10.0" ``` -------------------------------- ### File Operations Source: https://github.com/abiosoft/colima/blob/main/_autodocs/extension-guide.md Examples of performing file operations (read, write, stat) on the guest system. ```go // Read content, _ := c.guest.Read("/etc/config.txt") // Write c.guest.Write("/etc/config.txt", []byte("content")) // Check existence if info, err := c.guest.Stat("/etc/config.txt"); err == nil { println("File exists") } ``` -------------------------------- ### Command Example Source: https://github.com/abiosoft/colima/blob/main/_autodocs/cli-utilities.md Example of how to use the Command function. ```go cmd := cli.Command("docker", "ps") err := cmd.Run() if err != nil { fmt.Println("Command failed:", err) } ``` -------------------------------- ### Guest Command Execution Source: https://github.com/abiosoft/colima/blob/main/_autodocs/extension-guide.md Examples of executing commands within the guest environment using `guest` actions. ```go // Run with output suppression c.guest.RunQuiet("command", "arg1", "arg2") // Get output output, _ := c.guest.RunOutput("command", "arg1") // Interactive c.guest.RunInteractive("editor", "file.txt") // With custom I/O c.guest.RunWith(stdin, stdout, "cat") ``` -------------------------------- ### Host Dependency Injection Source: https://github.com/abiosoft/colima/blob/main/_autodocs/extension-guide.md Example of implementing the `Dependencies` method to declare host dependencies for a custom runtime. ```go func (c *customRuntime) Dependencies() []string { return []string{"custom-cli"} // Homebrew package name } ``` ```go if err := host.IsInstalled(customRuntime); err != nil { return fmt.Errorf("dependency check failed: %w", err) } ``` -------------------------------- ### Semantic Versioning Compatibility Source: https://github.com/abiosoft/colima/blob/main/_autodocs/extension-guide.md Example of checking interface stability using semantic versioning principles. ```go import "github.com/abiosoft/colima/config" // Interface is stable (no breaking changes expected) var _ environment.Container = (*customRuntime)(nil) ``` -------------------------------- ### Prompt Example Source: https://github.com/abiosoft/colima/blob/main/_autodocs/cli-utilities.md Example of how to use the Prompt function for a simple confirmation. ```go if cli.Prompt("Are you sure you want to delete the instance") { fmt.Println("Proceeding with deletion...") } else { fmt.Println("Operation cancelled") } ``` -------------------------------- ### Start Colima with Incus Runtime Source: https://github.com/abiosoft/colima/blob/main/README.md Starts Colima using the Incus runtime. Requires the Incus client to be installed. Note: VM support on Incus requires specific hardware. ```bash colima start --runtime incus incus launch images:alpine/edge incus list ``` -------------------------------- ### Start Colima with Docker Runtime Source: https://github.com/abiosoft/colima/blob/main/README.md Initiates Colima using the Docker runtime. Ensure the Docker client is installed and accessible. ```bash colima start docker run hello-world docker ps ``` -------------------------------- ### CLI Flags Source: https://github.com/abiosoft/colima/blob/main/_autodocs/extension-guide.md Example of adding a CLI flag for a custom field. ```go // In cmd/start.go init() startCmd.Flags().StringVar(&startCmdArgs.CustomField, "custom-field", "", "Custom field description") ``` -------------------------------- ### Virtual Machine Type Selection Examples Source: https://github.com/abiosoft/colima/blob/main/_autodocs/README.md CLI commands for starting Colima with different virtual machine implementations. ```bash # QEMU (default, all platforms) colima start --vm-type qemu # macOS Virtualization.Framework (macOS 13+) colima start --vm-type vz # Krunkit for AI workloads (Apple Silicon only) colima start --vm-type krunkit --runtime docker ``` -------------------------------- ### Start Colima with Kubernetes Enabled Source: https://github.com/abiosoft/colima/blob/main/README.md Enables Kubernetes on Colima. Requires `kubectl` to be installed. Use `kubectl` commands to interact with the cluster. ```bash colima start --kubernetes kubectl run caddy --image=caddy kubectl get pods ``` -------------------------------- ### Importing Source: https://github.com/abiosoft/colima/blob/main/_autodocs/extension-guide.md To enable the runtime, import it in main.go. ```go package main import ( _ "github.com/abiosoft/colima/cmd" _ "github.com/abiosoft/colima/environment/container/custom" ) ``` -------------------------------- ### Version Function Example Source: https://github.com/abiosoft/colima/blob/main/_autodocs/app-interface.md An example of how to call the Version function. ```go app, _ := app.New() if err := app.Version(); err != nil { fmt.Println("Error getting version:", err) } ``` -------------------------------- ### Load Function Example Source: https://github.com/abiosoft/colima/blob/main/_autodocs/store-module.md Example demonstrating how to load the store and handle potential errors, then print disk status. ```go store, err := store.Load() if err != nil { fmt.Println("Failed to load store:", err) } fmt.Println("Disk formatted:", store.DiskFormatted) fmt.Println("Disk runtime:", store.DiskRuntime) ``` -------------------------------- ### App Lifecycle Source: https://github.com/abiosoft/colima/blob/main/_autodocs/extension-guide.md Interface calls for managing the application lifecycle (provision, start, stop, teardown). ```go // At start container.Provision(ctx) // Install container.Start(ctx) // Run // At stop container.Stop(ctx, force) // Graceful/force shutdown // At delete container.Teardown(ctx) // Uninstall ``` -------------------------------- ### Context Propagation Source: https://github.com/abiosoft/colima/blob/main/_autodocs/extension-guide.md Example of accessing Colima configuration from the context within a container. ```go import "github.com/abiosoft/colima/config" func (c *customRuntime) Provision(ctx context.Context) error { cfg, _ := ctx.Value(config.CtxKey()).(config.Config) // Use config if cfg.Network.Address { // Handle network config } } ``` -------------------------------- ### Container Runtime Selection Examples Source: https://github.com/abiosoft/colima/blob/main/_autodocs/README.md CLI commands for starting Colima with different container runtimes. ```bash # Docker (default) colima start --runtime docker # Containerd colima start --runtime containerd # Incus colima start --runtime incus ``` -------------------------------- ### Usage Source: https://github.com/abiosoft/colima/blob/main/_autodocs/extension-guide.md After registration, use via CLI: ```bash colima start --runtime custom ``` -------------------------------- ### Custom Provisioning Source: https://github.com/abiosoft/colima/blob/main/_autodocs/extension-guide.md Use provision scripts to customize VM at boot: ```yaml provision: - mode: after-boot script: | sudo apt-get update sudo apt-get install -y custom-package sudo systemctl enable custom-service - mode: ready script: | custom-service --verify ``` -------------------------------- ### Setup and run AI models with Colima Source: https://github.com/abiosoft/colima/blob/main/docs/FAQ.md These commands are used to set up and run AI models after Colima has been started with the appropriate configuration for AI workloads. ```sh colima model setup colima model run gemma3 ``` -------------------------------- ### Registration Source: https://github.com/abiosoft/colima/blob/main/_autodocs/extension-guide.md Register the runtime in an `init()` function. ```go func init() { environment.RegisterContainer("custom", NewCustomRuntime, false) } ``` -------------------------------- ### Start with custom mounts Source: https://github.com/abiosoft/colima/blob/main/_autodocs/cli-commands.md Starts a Colima instance with specified directories mounted. ```bash colima start --mount ~/projects --mount /data:/mnt/data:w ``` -------------------------------- ### Configuration Validation Source: https://github.com/abiosoft/colima/blob/main/_autodocs/extension-guide.md Example of validating a custom field within the configuration validation function. ```go // In config/configmanager/configmanager.go if c.CustomField != "" { if !isValid(c.CustomField) { return fmt.Errorf("invalid customField: %s", c.CustomField) } } ``` -------------------------------- ### Constructor Function Source: https://github.com/abiosoft/colima/blob/main/_autodocs/extension-guide.md Implement the constructor. ```go func NewCustomRuntime(host environment.HostActions, guest environment.GuestActions) environment.Container { return &customRuntime{ host: host, guest: guest, } } ``` -------------------------------- ### Adding a Subcommand Source: https://github.com/abiosoft/colima/blob/main/_autodocs/extension-guide.md Create a new command file. ```go // cmd/custom.go package cmd import ( "github.com/spf13/cobra" "github.com/abiosoft/colima/cmd/root" ) var customCmd = &cobra.Command{ Use: "custom", Short: "Custom command", Long: "Custom command description", RunE: func(cmd *cobra.Command, args []string) error { // Implement command logic return nil }, } func init() { root.Cmd().AddCommand(customCmd) } ``` -------------------------------- ### Start Colima with Defaults Source: https://github.com/abiosoft/colima/blob/main/README.md Use this command to start Colima with its default configuration. No specific runtime or settings are required. ```bash colima start ``` -------------------------------- ### QEMU Not Found Error Example Source: https://github.com/abiosoft/colima/blob/main/_autodocs/configmanager-module.md An example of an error message when the QEMU binary is not found. ```text cannot use vmType: 'qemu', error: qemu-system-... not found ``` -------------------------------- ### Reset Function Example Source: https://github.com/abiosoft/colima/blob/main/_autodocs/store-module.md Example demonstrating how to call the Reset function and handle any errors that occur during the reset process. ```go if err := store.Reset(); err != nil { fmt.Println("Failed to reset store:", err) } ``` -------------------------------- ### Prompt Example with Color Source: https://github.com/abiosoft/colima/blob/main/_autodocs/cli-utilities.md Example of using ANSI color codes in the prompt question. ```go question := "\033[31m\033[1mthis will delete ALL container data. Are you sure you want to continue" if cli.Prompt(question) { // Proceed with deletion } ``` -------------------------------- ### Runtime Function Example Source: https://github.com/abiosoft/colima/blob/main/_autodocs/app-interface.md An example of how to call the Runtime function and print the result. ```go app, _ := app.New() runtime, err := app.Runtime() if err == nil { fmt.Println("Current runtime:", runtime) } ``` -------------------------------- ### Start Container Runtime Source: https://github.com/abiosoft/colima/blob/main/_autodocs/environment-interfaces.md Starts the container runtime. ```go Start(ctx context.Context) error ``` -------------------------------- ### Extending Config Structure Source: https://github.com/abiosoft/colima/blob/main/_autodocs/extension-guide.md Example of adding a custom field to the Colima configuration structure. ```go type Config struct { // ... existing fields ... CustomField string `yaml:"customField,omitempty"` } ``` -------------------------------- ### Start with custom resources Source: https://github.com/abiosoft/colima/blob/main/_autodocs/cli-commands.md Starts a Colima instance with specified CPU, memory, and disk sizes. ```bash colima start --cpus 4 --memory 8 --disk 100 ``` -------------------------------- ### Start Colima with Containerd Runtime Source: https://github.com/abiosoft/colima/blob/main/README.md Starts Colima with the Containerd runtime. Use `colima nerdctl` to interact with Containerd. ```bash colima start --runtime containerd nerdctl run hello-world nerdctl ps ``` -------------------------------- ### CommandInteractive Example Source: https://github.com/abiosoft/colima/blob/main/_autodocs/cli-utilities.md Example of how to use the CommandInteractive function. ```go cmd := cli.CommandInteractive("vim", "/tmp/config.yaml") err := cmd.Run() ``` -------------------------------- ### Programmatic Usage Example Source: https://github.com/abiosoft/colima/blob/main/_autodocs/README.md Go program demonstrating how to use the Colima application interface to start and manage a Colima instance programmatically. ```go package main import ( "github.com/abiosoft/colima/app" "github.com/abiosoft/colima/config" ) func main() { // Create app instance colima, err := app.New() if err != nil { panic(err) } // Start with configuration cfg := config.Config{ CPU: 4, Memory: 8, Disk: 100, Runtime: "docker", } if err := colima.Start(cfg); err != nil { panic(err) } // Check if active if colima.Active() { println("Colima is running") } // Stop when done colima.Stop(false) } ``` -------------------------------- ### Registration Source: https://github.com/abiosoft/colima/blob/main/_autodocs/extension-guide.md Commands are auto-registered via `init()` import: ```go // cmd/colima/main.go import _ "github.com/abiosoft/colima/cmd" ``` -------------------------------- ### Update Function Example Source: https://github.com/abiosoft/colima/blob/main/_autodocs/app-interface.md An example of how to call the Update function. ```go app, _ := app.New() if err := app.Update(); err != nil { fmt.Println("Error updating:", err) } ``` -------------------------------- ### Complete Configuration Example Source: https://github.com/abiosoft/colima/blob/main/_autodocs/configuration-reference.md A comprehensive example of a Colima configuration file. ```yaml # Virtual Machine Configuration cpu: 4 memory: 8 disk: 100 rootDisk: 20 arch: aarch64 hostname: colima-dev vimType: vz rosetta: false binfmt: true nestedVirtualization: false cpuType: "" diskImage: "" # Port Forwarding portForwarder: ssh # Network Configuration network: address: false mode: shared dns: [] dnsHosts: {} hostAddresses: false interface: en0 preferredRoute: false gatewayAddress: 192.168.5.2 # Volume Mounts mounts: - location: ~/projects writable: true mountType: virtiofs mountInotify: true # SSH Configuration sshPort: 0 forwardAgent: false sshConfig: true # Container Runtime runtime: docker autoActivate: true # Kubernetes kubernetes: enabled: false version: v1.28.0 k3sArgs: - --disable=traefik port: 0 # Docker Configuration docker: {} # Environment Variables env: LANG: en_US.UTF-8 # Provision Scripts provision: [] # AI Models modelRunner: docker ``` -------------------------------- ### CLI Usage Examples Source: https://github.com/abiosoft/colima/blob/main/_autodocs/README.md Common Colima CLI commands for starting, stopping, managing instances, and checking status. ```bash # Start Colima with Docker colima start # Start with Kubernetes colima start --kubernetes # Start with custom resources colima start --cpus 4 --memory 8 --disk 100 # Stop Colima colima stop # SSH into VM colima ssh # Check status colima status ``` -------------------------------- ### Install Colima with Nix Source: https://github.com/abiosoft/colima/blob/main/README.md Use this command to install Colima via Nix. ```shell nix-env -iA nixpkgs.colima ``` -------------------------------- ### Start containerd with Kubernetes Source: https://github.com/abiosoft/colima/blob/main/_autodocs/cli-commands.md Starts a Colima instance using containerd as the runtime and enables Kubernetes. ```bash colima start --runtime containerd --kubernetes ``` -------------------------------- ### Start with DNS configuration Source: https://github.com/abiosoft/colima/blob/main/_autodocs/cli-commands.md Starts a Colima instance with custom DNS servers and host mappings. ```bash colima start --dns 1.1.1.1 --dns 8.8.8.8 --dns-host example.com=192.168.1.1 ``` -------------------------------- ### Start Colima with Custom CPU, Memory, and Disk Source: https://github.com/abiosoft/colima/blob/main/README.md Create a Colima VM with specified CPU, memory, and disk size. Adjust these values based on your workload requirements. ```bash colima start --cpu 1 --memory 2 --disk 10 ``` -------------------------------- ### Flag Definition Source: https://github.com/abiosoft/colima/blob/main/_autodocs/extension-guide.md Add flags in init: ```go func init() { root.Cmd().AddCommand(customCmd) customCmd.Flags().StringP("option", "o", "default", "Option description") } ``` -------------------------------- ### Install Colima with Mise Source: https://github.com/abiosoft/colima/blob/main/README.md Use this command to install Colima via Mise. ```shell mise use -g colima@latest ``` -------------------------------- ### Binary - Install Source: https://github.com/abiosoft/colima/blob/main/docs/INSTALL.md Installs the downloaded Colima binary into the system's PATH. ```sh # install in $PATH sudo install colima-$(uname)-$(uname -m) /usr/local/bin/colima ``` -------------------------------- ### New Function Example Source: https://github.com/abiosoft/colima/blob/main/_autodocs/app-interface.md An example of how to create a new Colima app instance and check if it's active. ```go app, err := app.New() if err != nil { fmt.Println("Failed to create app:", err) return } if app.Active() { fmt.Println("Colima is running") } ``` -------------------------------- ### Kubernetes Function Example Source: https://github.com/abiosoft/colima/blob/main/_autodocs/app-interface.md An example of how to call the Kubernetes function and check if it's running. ```go app, _ := app.New() k8s, err := app.Kubernetes() if err == nil { if k8s.Running(context.Background()) { fmt.Println("Kubernetes is running") } } ``` -------------------------------- ### Implementing a Container Runtime Source: https://github.com/abiosoft/colima/blob/main/_autodocs/extension-guide.md To add a new container runtime, implement the `environment.Container` interface. ```go package custom import ( "context" "github.com/abiosoft/colima/environment" ) type customRuntime struct { host environment.HostActions guest environment.GuestActions } // Implement required methods func (c *customRuntime) Name() string { return "custom" } func (c *customRuntime) Provision(ctx context.Context) error { // Install and configure custom runtime return c.guest.Run("sudo", "apt-get", "install", "custom-runtime") } func (c *customRuntime) Start(ctx context.Context) error { return c.guest.Run("sudo", "systemctl", "start", "custom.service") } func (c *customRuntime) Stop(ctx context.Context, force bool) error { args := []string{"sudo", "systemctl", "stop", "custom.service"} if force { args = append(args, "--force") } return c.guest.Run(args...) } func (c *customRuntime) Teardown(ctx context.Context) error { return c.guest.Run("sudo", "apt-get", "remove", "-y", "custom-runtime") } func (c *customRuntime) Update(ctx context.Context) (bool, error) { return false, nil // Or implement update logic } func (c *customRuntime) Version(ctx context.Context) string { output, _ := c.guest.RunOutput("custom-runtime", "--version") return output } func (c *customRuntime) Running(ctx context.Context) bool { return c.guest.RunQuiet("sudo", "systemctl", "is-active", "custom.service") == nil } func (c *customRuntime) Dependencies() []string { return []string{} // No host dependencies for in-VM runtime } ``` -------------------------------- ### Teardown() Method Example Source: https://github.com/abiosoft/colima/blob/main/_autodocs/environment-interfaces.md Example of how to use the Teardown() method to remove the virtual machine. ```go err := vm.Teardown(context.Background()) if err != nil { fmt.Println("Teardown failed:", err) } ``` -------------------------------- ### Set Function Example Source: https://github.com/abiosoft/colima/blob/main/_autodocs/store-module.md Example showing how to use the Set function to update the DiskFormatted and DiskRuntime fields of the store. ```go err := store.Set(func(s *store.Store) { s.DiskFormatted = true s.DiskRuntime = "docker" }) if err != nil { fmt.Println("Failed to update store:", err) } ``` -------------------------------- ### Start with Apple Silicon specific settings Source: https://github.com/abiosoft/colima/blob/main/_autodocs/cli-commands.md Starts a Colima instance with settings optimized for Apple Silicon, including Rosetta emulation. ```bash colima start --vm-type vz --vz-rosetta ``` -------------------------------- ### Install Colima with Homebrew Source: https://github.com/abiosoft/colima/blob/main/README.md Use this command to install Colima via Homebrew. ```shell brew install colima ``` -------------------------------- ### Teardown Example Source: https://github.com/abiosoft/colima/blob/main/_autodocs/configmanager-module.md An example of how to call the Teardown function and handle potential errors. ```go if err := configmanager.Teardown(); err != nil { log.Fatal(err) } ``` -------------------------------- ### Building Colima Source: https://github.com/abiosoft/colima/blob/main/_autodocs/extension-guide.md Steps to clone the repository, build, and run Colima locally, including running with custom changes. ```bash # Clone repository git clone https://github.com/abiosoft/colima.git cd colima # Build make build # Run ./colima start # With your changes go run ./cmd/colima/main.go start ``` -------------------------------- ### YAML Configuration Example Source: https://github.com/abiosoft/colima/blob/main/_autodocs/configuration-types.md An example of Colima configuration in YAML format. ```yaml cpu: 4 memory: 8 disk: 100 arch: aarch64 runtime: docker vimType: vz network: address: false mode: shared dns: - 1.1.1.1 - 8.8.8.8 kubernetes: enabled: false version: v1.28.0 k3sArgs: - --disable=traefik mounts: - location: ~/ writable: true env: HTTP_PROXY: http://proxy.example.com:8080 provision: - mode: after-boot script: | echo "VM booted" - mode: ready script: | docker ps ``` -------------------------------- ### SSH() Method Example Source: https://github.com/abiosoft/colima/blob/main/_autodocs/app-interface.md Demonstrates how to execute a command on the Colima VM via SSH. ```go app, _ := app.New() if err := app.SSH("uname", "-a"); err != nil { fmt.Println("Error running SSH command:", err) } ``` -------------------------------- ### Building from Source - Clone and Build Source: https://github.com/abiosoft/colima/blob/main/docs/INSTALL.md Clones the Colima repository, navigates into it, and builds the project. ```bash # clone repo and cd into it git clone https://github.com/abiosoft/colima cd colima make sudo make install ``` -------------------------------- ### Ramalama Installation Source: https://github.com/abiosoft/colima/blob/main/_autodocs/model-runner.md Instructions for installing the Ramalama tool, which is a separate dependency. ```bash # Ramalama is a separate tool # Check https://github.com/containers/ramalama for installation ``` -------------------------------- ### Colima VM ping output example Source: https://github.com/abiosoft/colima/blob/main/docs/FAQ.md Example output of pinging google.com from within the Colima VM, indicating successful network connectivity. ```text colima ssh -- ping -c4 google.com PING google.com (216.58.223.238): 56 data bytes 64 bytes from 216.58.223.238: seq=0 ttl=42 time=0.082 ms 64 bytes from 216.58.223.238: seq=1 ttl=42 time=0.557 ms 64 bytes from 216.58.223.238: seq=2 ttl=42 time=0.465 ms 64 bytes from 216.58.223.238: seq=3 ttl=42 time=0.457 ms --- google.com ping statistics --- 4 packets transmitted, 4 packets received, 0% packet loss round-trip min/avg/max = 0.082/0.390/0.557 ms ``` -------------------------------- ### Implementing a Model Runner Source: https://github.com/abiosoft/colima/blob/main/_autodocs/extension-guide.md The model runner interface. ```go type ModelRunner interface { Run(ctx context.Context, args ...string) error Name() string } ``` -------------------------------- ### Configuration Merge Example Source: https://github.com/abiosoft/colima/blob/main/_autodocs/configmanager-module.md An example demonstrating how CLI flags override configuration file settings. ```bash # Config file has cpu: 2 # CLI flag overrides colima start --cpus 4 # Results in cpu: 4 # All other config from file is preserved ``` -------------------------------- ### Install Colima with MacPorts Source: https://github.com/abiosoft/colima/blob/main/README.md Use this command to install Colima via MacPorts. Requires sudo privileges. ```shell sudo port install colima ``` -------------------------------- ### Colima list output example Source: https://github.com/abiosoft/colima/blob/main/docs/FAQ.md Example output of the 'colima list' command showing a 'Broken' status for an instance. ```text colima list PROFILE STATUS ARCH CPUS MEMORY DISK RUNTIME ADDRESS default Broken aarch64 2 2GiB 60GiB ``` -------------------------------- ### Testing Source: https://github.com/abiosoft/colima/blob/main/_autodocs/extension-guide.md Commands to run Go tests, including integration tests. ```bash # Run tests go test ./... # Integration tests go test -tags integration ./... ``` -------------------------------- ### Start and keep in foreground Source: https://github.com/abiosoft/colima/blob/main/_autodocs/cli-commands.md Starts a Colima instance and keeps the process in the foreground. ```bash colima start --foreground ``` -------------------------------- ### Distribution as a Fork Source: https://github.com/abiosoft/colima/blob/main/_autodocs/extension-guide.md Steps for maintaining a fork of Colima with custom extensions. ```bash git remote add fork https://github.com/yourorg/colima.git git pull fork main git push origin main ``` -------------------------------- ### Install nerdctl CLI tool Source: https://github.com/abiosoft/colima/blob/main/_autodocs/cli-commands.md Installs the nerdctl CLI tool on the Colima instance. ```bash colima nerdctl install ``` -------------------------------- ### Colima Help Commands Source: https://github.com/abiosoft/colima/blob/main/README.md Access help information for Colima and its start command to understand available options and configurations. ```bash colima --help ``` ```bash colima start --help ``` -------------------------------- ### Distribution as a Separate Package Source: https://github.com/abiosoft/colima/blob/main/_autodocs/extension-guide.md Steps for distributing custom extensions as an independent package. ```bash 1. Create repository: `colima-custom-runtime` 2. Implement `Container` interface 3. Provide import path 4. Document integration steps 5. Users import: `_ "github.com/yourorg/colima-custom-runtime"` ``` -------------------------------- ### Status Function Example (JSON Output) Source: https://github.com/abiosoft/colima/blob/main/_autodocs/app-interface.md An example of how to call the Status function with extended details and JSON output enabled. ```go app, _ := app.New() if err := app.Status(true, true); err != nil { fmt.Println("Error getting status:", err) } ``` -------------------------------- ### Start Colima with custom DNS servers Source: https://github.com/abiosoft/colima/blob/main/docs/FAQ.md Start a Colima instance with specified DNS servers to resolve internet connectivity issues. ```sh colima start --dns 8.8.8.8 --dns 1.1.1.1 ``` -------------------------------- ### Integration Testing Source: https://github.com/abiosoft/colima/blob/main/_autodocs/extension-guide.md Command to run integration tests for custom components. ```bash go test -tags integration -run TestCustomRuntime ./... ``` -------------------------------- ### Run Models Example Source: https://github.com/abiosoft/colima/blob/main/_autodocs/model-runner.md Example command to run a model using the default Docker AI Registry. ```bash # Run with default Docker AI Registry colima model run gemma3 ``` -------------------------------- ### Distribution as a Patch Source: https://github.com/abiosoft/colima/blob/main/_autodocs/extension-guide.md Steps for contributing extensions back to the main Colima project. ```bash git checkout -b feature/custom-runtime # Make changes git push origin feature/custom-runtime # Create pull request ``` -------------------------------- ### Start Colima for AI Models with GPU Acceleration Source: https://github.com/abiosoft/colima/blob/main/README.md Starts Colima with the Docker runtime and `krunkit` VM type for GPU-accelerated AI workloads. Requires macOS 13+ and Apple Silicon. ```bash colima start --runtime docker --vm-type krunkit colima model run gemma3 ``` -------------------------------- ### Code Style Source: https://github.com/abiosoft/colima/blob/main/_autodocs/extension-guide.md Commands for formatting, linting, and vetting Go code. ```bash # Format code go fmt ./... # Lint golangci-lint run ./... # Vet go vet ./... ``` -------------------------------- ### Delete() Method Example Source: https://github.com/abiosoft/colima/blob/main/_autodocs/app-interface.md Provides an example of how to delete a Colima instance, with options to remove container data and skip confirmation. ```go app, _ := app.New() if err := app.Delete(true, false); err != nil { fmt.Println("Error deleting:", err) } ``` -------------------------------- ### Start Colima with a debug profile Source: https://github.com/abiosoft/colima/blob/main/docs/FAQ.md Start a new Colima instance with a specific profile name for testing upgrades or isolating issues. ```sh colima start debug ``` -------------------------------- ### Install Colima Latest Development Version (Homebrew) Source: https://github.com/abiosoft/colima/blob/main/README.md Install the bleeding-edge version of Colima using Homebrew. Use with caution. ```shell brew install --HEAD colima ``` -------------------------------- ### Configuring Mounts Source: https://github.com/abiosoft/colima/blob/main/_autodocs/README.md Examples of configuring directory mounts for a Colima instance. ```bash # Mount single directory colima start --mount ~/projects # Mount with custom path colima start --mount ~/projects:/mnt/code:w # Multiple mounts colima start --mount ~/projects --mount /data:/mnt/data ``` -------------------------------- ### Install Docker Buildx Plugin Manually Source: https://github.com/abiosoft/colima/blob/main/docs/FAQ.md Manually install the Docker buildx plugin by downloading the binary from GitHub releases. Adjust the `ARCH` variable for your system (e.g., 'amd64' or 'arm64'). ```sh ARCH=amd64 # change to 'arm64' for m1 VERSION=v0.11.2 curl -LO https://github.com/docker/buildx/releases/download/${VERSION}/buildx-${VERSION}.darwin-${ARCH} mkdir -p ~/.docker/cli-plugins mv buildx-${VERSION}.darwin-${ARCH} ~/.docker/cli-plugins/docker-buildx chmod +x ~/.docker/cli-plugins/docker-buildx docker buildx version # verify installation ``` -------------------------------- ### Stop() Method Example Source: https://github.com/abiosoft/colima/blob/main/_autodocs/app-interface.md Illustrates how to stop a Colima instance, with an option for forceful termination. ```go app, _ := app.New() if err := app.Stop(false); err != nil { fmt.Println("Error stopping:", err) } ``` -------------------------------- ### Quiet Context Usage Example Source: https://github.com/abiosoft/colima/blob/main/_autodocs/cli-utilities.md Example of using the CtxKeyQuiet context key to suppress logging output when executing commands. ```go ctx := context.WithValue(context.Background(), cli.CtxKeyQuiet, true) cmd := cli.Command("docker", "ps") // Execute with quiet context ``` -------------------------------- ### Profile Management Examples Source: https://github.com/abiosoft/colima/blob/main/_autodocs/README.md CLI commands for managing multiple Colima instances using profiles. ```bash # Default profile colima start # Custom profile colima start dev colima start prod # List all colima list # Switch via flag colima ssh --profile dev ``` -------------------------------- ### YAML Configuration File Example Source: https://github.com/abiosoft/colima/blob/main/_autodocs/configmanager-module.md An example of a Colima configuration file in YAML format, showing various settings. ```yaml cpu: 4 memory: 8 disk: 100 runtime: docker vmType: vz mountType: virtiofs network: address: false dns: - 1.1.1.1 kubernetes: enabled: false mounts: - location: ~/projects writable: true ``` -------------------------------- ### Start Colima with Registry Mirrors via Command Line Source: https://github.com/abiosoft/colima/blob/main/docs/FAQ.md Configure Colima to use specific registry mirrors directly on startup using the repeatable `--registry-mirror` flag. This avoids the need to edit configuration files. ```bash colima start --registry-mirror https://my.dockerhub.mirror.something --registry-mirror https://my.quayio.mirror.something ``` -------------------------------- ### Profile Names Source: https://github.com/abiosoft/colima/blob/main/_autodocs/cli-commands.md Demonstrates starting, stopping, and deleting instances using default and custom profiles, and using environment variables to set the profile. ```bash # Default profile colima start # Custom profile named "dev" colima start dev colima stop dev colima delete dev # Using environment variable export COLIMA_PROFILE=dev colima status # Shows status of 'dev' profile ``` -------------------------------- ### Example Store File Source: https://github.com/abiosoft/colima/blob/main/_autodocs/store-module.md A JSON representation of a Colima instance store file, showing example values for disk formatting, runtime, and provisioning. ```json { "disk_formatted": true, "disk_runtime": "docker", "ramalama_provisioned": false } ``` -------------------------------- ### Install Docker Buildx Plugin using Homebrew Source: https://github.com/abiosoft/colima/blob/main/docs/FAQ.md Install the Docker buildx plugin using Homebrew on macOS. Ensure to follow the post-installation steps to link the executable correctly. ```sh brew install docker-buildx # Follow the caveats mentioned in the install instructions: # mkdir -p ~/.docker/cli-plugins # ln -sfn $(which docker-buildx) ~/.docker/cli-plugins/docker-buildx docker buildx version # verify installation ``` -------------------------------- ### Load Config Example Source: https://github.com/abiosoft/colima/blob/main/_autodocs/configmanager-module.md Go code snippet to load the configuration for the current profile. ```go // Load config for current profile cfg, _ := configmanager.Load() // Validate before use configmanager.ValidateConfig(cfg) // Save changes configmanager.Save(cfg) // Load from specific file cfg, _ := configmanager.LoadFrom(filepath.Join(dir, "config.yaml")) ``` -------------------------------- ### Colima Store Usage Example Source: https://github.com/abiosoft/colima/blob/main/_autodocs/store-module.md A Go program demonstrating how to load the Colima store, check disk status, update the runtime, and optionally reset the store. ```go package main import ( "fmt" "github.com/abiosoft/colima/store" ) func main() { // Load current store s, err := store.Load() if err != nil { fmt.Println("Error loading store:", err) return } // Check disk status if !s.DiskFormatted { fmt.Println("Disk needs formatting") } // Update store with new runtime err = store.Set(func(s *store.Store) { s.DiskRuntime = "containerd" }) if err != nil { fmt.Println("Error updating store:", err) } // Reset if needed // err = store.Reset() } ``` -------------------------------- ### Run AI Models with Colima Source: https://github.com/abiosoft/colima/blob/main/README.md Examples of running AI models using Colima. Supports different registries and runners like Docker, HuggingFace, and Ollama. ```bash colima model run gemma3 colima model run llama3.2 colima model run hf.co/microsoft/Phi-3-mini-4k-instruct-gguf colima model run ollama://gemma3 --runner ramalama ``` -------------------------------- ### Solution for Invalid DNS Error Source: https://github.com/abiosoft/colima/blob/main/_autodocs/error-handling.md Example command to start Colima with valid DNS servers to resolve the 'invalid IP address' error during flag parsing. ```bash # Use valid DNS servers colima start --dns 1.1.1.1 --dns 8.8.8.8 ``` -------------------------------- ### Configuration File Examples Source: https://github.com/abiosoft/colima/blob/main/_autodocs/README.md CLI commands for viewing, editing, and generating Colima configuration files. ```bash # View current config cat ~/.colima/default/colima.yaml # Edit before startup colima start --edit # Generate template colima template --save ``` -------------------------------- ### Autostart Colima using brew services Source: https://github.com/abiosoft/colima/blob/main/docs/FAQ.md If Colima was installed via Homebrew, this command enables autostart functionality by managing Colima as a brew service. ```sh brew services start colima ``` -------------------------------- ### Solutions for Configuration File Not Found Errors Source: https://github.com/abiosoft/colima/blob/main/_autodocs/error-handling.md Commands to start with defaults or regenerate the configuration file. ```bash # Use defaults colima start # Regenerate config colima template --save colima start --edit ``` -------------------------------- ### Documentation Structure Source: https://github.com/abiosoft/colima/blob/main/_autodocs/extension-guide.md Markdown structure for documenting custom extensions. ```markdown # Custom Runtime ## Overview [Description] ## Installation [Build steps] ## Configuration [YAML and CLI examples] ## Usage [Usage examples] ``` -------------------------------- ### Enable Ubuntu Layer via CLI Source: https://github.com/abiosoft/colima/blob/main/docs/FAQ.md Use this command to start Colima with the Ubuntu layer enabled for older versions (v0.5.6 and lower). ```bash colima start --layer=true ``` -------------------------------- ### Krunkit Requirements Error Example Source: https://github.com/abiosoft/colima/blob/main/_autodocs/configmanager-module.md An example of an error message indicating that Krunkit is only available on macOS with Apple Silicon. ```text vmType 'krunkit' is only available on macOS with Apple Silicon ``` -------------------------------- ### Start VM with Model Support Source: https://github.com/abiosoft/colima/blob/main/_autodocs/model-runner.md Command to start the Colima VM with Docker runtime, krunkit VM type, and Docker model runner. ```bash # Start VM with model runner support colima start --runtime docker --vm-type krunkit --model-runner docker # Verify krunkit and GPU support colima ssh -- ls /dev/kfd ``` -------------------------------- ### Start Colima in foreground mode Source: https://github.com/abiosoft/colima/blob/main/docs/FAQ.md Use the --foreground flag to start Colima in foreground mode, useful for specific execution scenarios. ```sh colima start --foreground ``` -------------------------------- ### Docker Model Runner Usage Examples Source: https://github.com/abiosoft/colima/blob/main/_autodocs/model-runner.md Examples of running models using the Docker model runner, including default and HuggingFace registries. ```bash # Run model with default registry (Docker AI Registry) colima model run gemma3 # Run specific model colima model run llama3.2 # Run from HuggingFace colima model run hf.co/microsoft/Phi-3-mini-4k-instruct-gguf ``` -------------------------------- ### Scripted Colima Start and Status Check Source: https://github.com/abiosoft/colima/blob/main/_autodocs/error-handling.md A bash script demonstrating how to start Colima, handle potential errors, and check if Kubernetes is enabled, using exit codes for control flow. ```bash #!/bin/bash set -e # Exit on error # Start with logging if ! colima start; then echo "Failed to start Colima" colima status || echo "Instance in unknown state" exit 1 fi # Check status if ! colima status --json | jq -e '.kubernetes' > /dev/null; then echo "Kubernetes not enabled" exit 1 fi echo "Colima is ready" ``` -------------------------------- ### Ramalama Model Runner Usage Examples Source: https://github.com/abiosoft/colima/blob/main/_autodocs/model-runner.md Examples of running models using the Ramalama model runner, specifying HuggingFace and Ollama registries. ```bash # Run model from HuggingFace colima model run --runner ramalama # Run model from Ollama colima model run ollama://gemma3 --runner ramalama ``` -------------------------------- ### Binary - Download Source: https://github.com/abiosoft/colima/blob/main/docs/INSTALL.md Downloads the Colima binary from the latest release. ```sh # download binary curl -LO https://github.com/abiosoft/colima/releases/latest/download/colima-$(uname)-$(uname -m) ``` -------------------------------- ### Run with additional arguments Source: https://github.com/abiosoft/colima/blob/main/_autodocs/model-runner.md Example of passing additional arguments to the model runner. ```bash colima model run gemma3 -- --temperature 0.7 --top-p 0.9 ``` -------------------------------- ### Default Configuration Example Source: https://github.com/abiosoft/colima/blob/main/_autodocs/configmanager-module.md The default configuration applied by Colima when no configuration file exists. ```yaml cpu: 2 memory: 2 disk: 100 rootDisk: 20 arch: vmType: qemu # or vz on macOS 13+ mountType: sshfs # or virtiofs for vz runtime: docker sshConfig: true mountInotify: true ``` -------------------------------- ### Disk GiB Method Source: https://github.com/abiosoft/colima/blob/main/_autodocs/configuration-types.md Returns the disk size as a string in GiB. Example: `Disk(100).GiB()` returns "100GiB" ```go func (d Disk) GiB() string ``` -------------------------------- ### Active() Method Example Source: https://github.com/abiosoft/colima/blob/main/_autodocs/app-interface.md Demonstrates how to check if a Colima instance is currently running using the `Active()` method. ```go app, _ := app.New() if app.Active() { fmt.Println("Colima is running") } ``` -------------------------------- ### List Available Runtimes Command Source: https://github.com/abiosoft/colima/blob/main/_autodocs/container-runtimes.md Bash command to list available container runtimes that can be started with Colima. ```bash colima start --help | grep -A1 "runtime" ``` -------------------------------- ### Recreate Colima instance after upgrade Source: https://github.com/abiosoft/colima/blob/main/docs/FAQ.md Delete the current Colima instance and start a new one to apply the latest VM image after an upgrade. ```sh colima delete colima start ``` -------------------------------- ### Recovery from VM Lifecycle Errors Source: https://github.com/abiosoft/colima/blob/main/_autodocs/error-handling.md Commands to delete and restart the VM to recover from start failures. ```bash colima delete --force colima start --foreground # See detailed logs ``` -------------------------------- ### Run HuggingFace models with parameters Source: https://github.com/abiosoft/colima/blob/main/_autodocs/model-runner.md Example of passing parameters to a HuggingFace model runner. ```bash colima model run hf.co/model:tag -- --param value ``` -------------------------------- ### Arch Linux - Dependencies Source: https://github.com/abiosoft/colima/blob/main/docs/INSTALL.md Installs necessary dependencies for Colima on Arch Linux. ```bash sudo pacman -S qemu-full go docker ``` -------------------------------- ### Nix - Nix Shell Source: https://github.com/abiosoft/colima/blob/main/docs/INSTALL.md Installs Colima for use solely within a nix-shell. ```bash nix-shell -p colima ``` -------------------------------- ### Basic Command Execution Source: https://github.com/abiosoft/colima/blob/main/_autodocs/cli-utilities.md Demonstrates how to run a simple command using the `cli.Command` function. ```go package main import ( "fmt" "github.com/abiosoft/colima/cli" ) func main() { // Run a simple command cmd := cli.Command("echo", "Hello, Colima") if err := cmd.Run(); err != nil { fmt.Println("Error:", err) } } ``` -------------------------------- ### Nix - Stable Version Source: https://github.com/abiosoft/colima/blob/main/docs/INSTALL.md Installs the stable version of Colima using Nix. ```bash nix-env -i colima ``` -------------------------------- ### MacPorts - Stable Version Source: https://github.com/abiosoft/colima/blob/main/docs/INSTALL.md Installs the stable version of Colima using MacPorts. ```bash sudo port install colima ``` -------------------------------- ### Homebrew - Development Version Source: https://github.com/abiosoft/colima/blob/main/docs/INSTALL.md Installs the development version of Colima using Homebrew. ```bash brew install --HEAD colima ``` -------------------------------- ### CommandChain Init Method Source: https://github.com/abiosoft/colima/blob/main/_autodocs/cli-utilities.md Initializes the command chain with a context. ```go func (c CommandChain) Init(ctx context.Context) CommandChain ``` -------------------------------- ### Homebrew - Stable Version Source: https://github.com/abiosoft/colima/blob/main/docs/INSTALL.md Installs the stable version of Colima using Homebrew. ```bash brew install colima ``` -------------------------------- ### Install Incus CLI Dependency Source: https://github.com/abiosoft/colima/blob/main/_autodocs/container-runtimes.md Homebrew command to install the Incus CLI, a dependency for the Incus runtime. ```bash brew install incus # For incus CLI ``` -------------------------------- ### Install Docker CLI Dependency Source: https://github.com/abiosoft/colima/blob/main/_autodocs/container-runtimes.md Homebrew command to install the Docker CLI, a dependency for the Docker runtime. ```bash brew install docker # For docker CLI ``` -------------------------------- ### Start instance with increased memory Source: https://github.com/abiosoft/colima/blob/main/_autodocs/model-runner.md Command to start a Colima instance with increased memory allocation. ```bash colima start --memory 16 --model-runner docker ``` -------------------------------- ### Arch Linux - Lima and Colima from Aur Source: https://github.com/abiosoft/colima/blob/main/docs/INSTALL.md Installs Lima and Colima from the Arch User Repository (AUR). ```bash yay -S lima-bin colima-bin ``` -------------------------------- ### Port Forwarder Validation Error Example Source: https://github.com/abiosoft/colima/blob/main/_autodocs/configmanager-module.md An example of a validation error message for an invalid port forwarder. ```text invalid port forwarder: 'invalid' ``` -------------------------------- ### VM Type Validation Error Example Source: https://github.com/abiosoft/colima/blob/main/_autodocs/configmanager-module.md An example of a validation error message for an invalid VM type. ```text invalid vmType: 'invalid' ``` -------------------------------- ### Mount Type Validation Error Example Source: https://github.com/abiosoft/colima/blob/main/_autodocs/configmanager-module.md An example of a validation error message for an invalid mount type. ```text invalid mountType: 'invalid' ``` -------------------------------- ### StoreFile() Function Source: https://github.com/abiosoft/colima/blob/main/_autodocs/configuration-types.md Returns the path to the store file. ```go func (p *Profile) StoreFile() string ``` -------------------------------- ### Disk Image Validation Error Example Source: https://github.com/abiosoft/colima/blob/main/_autodocs/configmanager-module.md An example of a validation error message for an invalid disk image source. ```text cannot use diskImage: remote URLs not supported, only local files can be specified ``` -------------------------------- ### Start Colima VM with Custom Environment Variables Source: https://github.com/abiosoft/colima/blob/main/docs/FAQ.md Pass environment variables directly to the Colima VM during startup using the `--env` command-line flag. This allows for dynamic configuration without editing YAML files. ```bash $ colima start --env MY_VAR=value ``` -------------------------------- ### Solution for Lima Not Installed Error Source: https://github.com/abiosoft/colima/blob/main/_autodocs/error-handling.md Command to install Lima, which is a prerequisite for Colima, to resolve the 'dependency check failed for VM' error. ```bash brew install lima ``` -------------------------------- ### Start instance with custom environment variable Source: https://github.com/abiosoft/colima/blob/main/_autodocs/model-runner.md Command to start a Colima instance with a custom environment variable for model caching. ```bash colima start --env MODEL_CACHE=/mnt/cache --model-runner docker ``` -------------------------------- ### StateFile() Function Source: https://github.com/abiosoft/colima/blob/main/_autodocs/configuration-types.md Returns the path to the state file. ```go func (p *Profile) StateFile() string ``` -------------------------------- ### Starting VMNet daemon (bridged mode) Source: https://github.com/abiosoft/colima/blob/main/embedded/network/sudo.txt This command starts the VMNet daemon in bridged mode, enabling it to manage network interfaces for Colima. ```bash %staff ALL=(root:wheel) NOPASSWD:NOSETENV: /opt/colima/bin/socket_vmnet --vmnet-mode bridged --socket-group staff * ``` -------------------------------- ### AppVersion Function Source: https://github.com/abiosoft/colima/blob/main/_autodocs/configuration-types.md Returns the application version information. ```go func AppVersion() VersionInfo ``` -------------------------------- ### Starting VMNet daemon (shared mode) Source: https://github.com/abiosoft/colima/blob/main/embedded/network/sudo.txt This command starts the VMNet daemon in shared mode, allowing it to manage network interfaces for Colima. ```bash %staff ALL=(root:wheel) NOPASSWD:NOSETENV: /opt/colima/bin/socket_vmnet --vmnet-mode shared --socket-group staff --vmnet-gateway 192.168.106.1 --vmnet-dhcp-end 192.168.106.254 * ``` -------------------------------- ### Global CLI Settings Source: https://github.com/abiosoft/colima/blob/main/_autodocs/cli-utilities.md Global CLI settings structure. ```go var Settings = struct { Verbose bool }{} ``` -------------------------------- ### Start Colima with Rosetta 2 Emulation Source: https://github.com/abiosoft/colima/blob/main/README.md Enables Rosetta 2 emulation within the Colima VM using the `vz` VM type. Requires macOS 13+ on Apple Silicon. ```bash colima start --vm-type=vz --vz-rosetta ``` -------------------------------- ### Kubernetes Source: https://github.com/abiosoft/colima/blob/main/_autodocs/types-reference.md Kubernetes configuration. ```go type Kubernetes struct { Enabled bool `yaml:"enabled"` Version string `yaml:"version"` K3sArgs []string `yaml:"k3sArgs"` Port int `yaml:"port,omitempty"` } ``` -------------------------------- ### WithDir Function Source: https://github.com/abiosoft/colima/blob/main/_autodocs/environment-interfaces.md Creates a new instance with working directory set. ```go WithDir(dir string) HostActions ``` -------------------------------- ### Validate Configuration Source: https://github.com/abiosoft/colima/blob/main/_autodocs/configmanager-module.md Validates configuration for correctness and compatibility. Includes checks for MountType, PortForwarder, VMType, DiskImage, GatewayAddress, Runtime, Arch, QEMU installation, Krunkit installation, and macOS version checks. ```go func ValidateConfig(c config.Config) error ``` ```go cfg := config.Config{CPU: 4, VMType: "vz", MountType: "virtiofs"} if err := configmanager.ValidateConfig(cfg); err != nil { fmt.Printf("Invalid config: %v\n", err) } ``` -------------------------------- ### Profile Source: https://github.com/abiosoft/colima/blob/main/_autodocs/types-reference.md Profile configuration and paths. ```go type Profile struct { ID string DisplayName string ShortName string Changed bool // unexported fields } ``` -------------------------------- ### Load Instance Configuration Source: https://github.com/abiosoft/colima/blob/main/_autodocs/configmanager-module.md Loads the instance state configuration file. ```go func LoadInstance() (config.Config, error) ``` -------------------------------- ### Get VM Architecture Source: https://github.com/abiosoft/colima/blob/main/_autodocs/environment-interfaces.md Returns the architecture of the VM. ```go Arch() Arch ``` -------------------------------- ### Get User Source: https://github.com/abiosoft/colima/blob/main/_autodocs/environment-interfaces.md Returns the username of the user in the VM. ```go User() (string, error) ``` -------------------------------- ### Enable Kubernetes Source: https://github.com/abiosoft/colima/blob/main/_autodocs/cli-commands.md Enables Kubernetes on a running Colima instance. ```bash colima kubernetes enable ``` -------------------------------- ### Run Method Source: https://github.com/abiosoft/colima/blob/main/_autodocs/environment-interfaces.md Runs a command with output visible to user. ```go Run(args ...string) error ``` -------------------------------- ### List Available Docker Contexts Source: https://github.com/abiosoft/colima/blob/main/docs/FAQ.md View all configured Docker contexts, including Colima's, to understand which Docker environments are available and to select the active one. ```bash docker context list ``` -------------------------------- ### User Confirmation Source: https://github.com/abiosoft/colima/blob/main/_autodocs/cli-utilities.md Shows how to prompt the user for confirmation using `cli.Prompt`. ```go package main import ( "fmt" "github.com/abiosoft/colima/cli" ) func main() { if cli.Prompt("Do you want to continue") { fmt.Println("Continuing...") } else { fmt.Println("Cancelled") } } ``` -------------------------------- ### Add Provision Scripts via colima.yaml Source: https://github.com/abiosoft/colima/blob/main/docs/FAQ.md Alternatively, provision scripts can be specified directly within the colima.yaml file using the '--edit' command. This allows for similar VM boot-time command execution. ```diff - provision: [] + provision: + - mode: system + script: | + #!/bin/bash + set -eux -o pipefail + apt-get update && apt-get install -y curl ``` -------------------------------- ### RunWith Method Source: https://github.com/abiosoft/colima/blob/main/_autodocs/environment-interfaces.md Runs with custom stdin and stdout. ```go RunWith(stdin io.Reader, stdout io.Writer, args ...string) error ``` -------------------------------- ### Get Container Runtime Version Source: https://github.com/abiosoft/colima/blob/main/_autodocs/environment-interfaces.md Returns the version of the container runtime. ```go Version(ctx context.Context) string ``` -------------------------------- ### Run with Ramalama backend Source: https://github.com/abiosoft/colima/blob/main/_autodocs/model-runner.md Example of specifying the Ramalama runner for a model. ```bash colima model run mistral --runner ramalama ```