|
| 1 | +# User Defaults Configuration |
| 2 | + |
| 3 | +The `container` CLI uses macOS user defaults to store configuration settings. These settings persist between sessions and allow you to customize the behavior of various commands. |
| 4 | + |
| 5 | +## Viewing Current Defaults |
| 6 | + |
| 7 | +To view a specific default value, use the macOS `defaults` command: |
| 8 | + |
| 9 | +```bash |
| 10 | +defaults read com.apple.container.defaults <key> |
| 11 | +``` |
| 12 | + |
| 13 | +## Available User Defaults |
| 14 | + |
| 15 | +### Build Settings |
| 16 | + |
| 17 | +#### build.rosetta |
| 18 | + |
| 19 | +Controls whether Rosetta translation is enabled during container builds. When enabled (default), allows building x86_64 images on Apple Silicon Macs. |
| 20 | + |
| 21 | +**Default:** `true` |
| 22 | + |
| 23 | +**Usage:** |
| 24 | +```bash |
| 25 | +# Disable Rosetta for builds |
| 26 | +defaults write com.apple.container.defaults build.rosetta -bool false |
| 27 | + |
| 28 | +# Enable Rosetta for builds (default) |
| 29 | +defaults write com.apple.container.defaults build.rosetta -bool true |
| 30 | + |
| 31 | +# Check current value |
| 32 | +defaults read com.apple.container.defaults build.rosetta |
| 33 | +``` |
| 34 | + |
| 35 | +**Note:** Disabling Rosetta will prevent building x86_64 images on Apple Silicon Macs. This setting only affects the build process and does not impact running containers. |
| 36 | + |
| 37 | +### Image Settings |
| 38 | + |
| 39 | +#### image.builder |
| 40 | + |
| 41 | +Specifies the default BuildKit image used for building containers. |
| 42 | + |
| 43 | +**Default:** `ghcr.io/apple/container-builder-shim/builder:<version>` |
| 44 | + |
| 45 | +**Usage:** |
| 46 | +```bash |
| 47 | +# Set a custom builder image |
| 48 | +defaults write com.apple.container.defaults image.builder "my-registry.com/my-builder:latest" |
| 49 | + |
| 50 | +# Reset to default |
| 51 | +defaults delete com.apple.container.defaults image.builder |
| 52 | +``` |
| 53 | + |
| 54 | +#### image.init |
| 55 | + |
| 56 | +Specifies the default init image used for container initialization. |
| 57 | + |
| 58 | +**Default:** `ghcr.io/apple/containerization/vminit:<version>` |
| 59 | + |
| 60 | +**Usage:** |
| 61 | +```bash |
| 62 | +# Set a custom init image |
| 63 | +defaults write com.apple.container.defaults image.init "my-registry.com/my-init:latest" |
| 64 | +``` |
| 65 | + |
| 66 | +### Network Settings |
| 67 | + |
| 68 | +#### dns.domain |
| 69 | + |
| 70 | +Sets the default local DNS domain for containers. |
| 71 | + |
| 72 | +**Default:** `test` |
| 73 | + |
| 74 | +**Usage:** |
| 75 | +```bash |
| 76 | +# Set a custom DNS domain |
| 77 | +defaults write com.apple.container.defaults dns.domain "mycompany.local" |
| 78 | + |
| 79 | +# Alternatively, use the container CLI |
| 80 | +container system dns default set mycompany.local |
| 81 | +``` |
| 82 | + |
| 83 | +### Registry Settings |
| 84 | + |
| 85 | +#### registry.domain |
| 86 | + |
| 87 | +Sets the default registry domain for pulling images. |
| 88 | + |
| 89 | +**Default:** `docker.io` |
| 90 | + |
| 91 | +**Usage:** |
| 92 | +```bash |
| 93 | +# Set a custom default registry |
| 94 | +defaults write com.apple.container.defaults registry.domain "ghcr.io" |
| 95 | + |
| 96 | +# Alternatively, use the container CLI |
| 97 | +container registry default set ghcr.io |
| 98 | +``` |
| 99 | + |
| 100 | +### Kernel Settings |
| 101 | + |
| 102 | +#### kernel.url |
| 103 | + |
| 104 | +URL for downloading the default kernel used by containers. |
| 105 | + |
| 106 | +**Default:** `https://github.com/kata-containers/kata-containers/releases/download/3.17.0/kata-static-3.17.0-arm64.tar.xz` |
| 107 | + |
| 108 | +**Usage:** |
| 109 | +```bash |
| 110 | +# Set a custom kernel URL |
| 111 | +defaults write com.apple.container.defaults kernel.url "https://myserver.com/custom-kernel.tar.xz" |
| 112 | +``` |
| 113 | + |
| 114 | +#### kernel.binaryPath |
| 115 | + |
| 116 | +Path within the kernel archive to the actual kernel binary. |
| 117 | + |
| 118 | +**Default:** `opt/kata/share/kata-containers/vmlinux-6.12.28-153` |
| 119 | + |
| 120 | +**Usage:** |
| 121 | +```bash |
| 122 | +# Set a custom kernel binary path |
| 123 | +defaults write com.apple.container.defaults kernel.binaryPath "path/to/vmlinux" |
| 124 | +``` |
| 125 | + |
| 126 | +## Resetting Defaults |
| 127 | + |
| 128 | +To reset a specific setting to its default value: |
| 129 | + |
| 130 | +```bash |
| 131 | +defaults delete com.apple.container.defaults <key> |
| 132 | +``` |
| 133 | + |
| 134 | +To reset all container defaults: |
| 135 | + |
| 136 | +```bash |
| 137 | +defaults delete com.apple.container.defaults |
| 138 | +``` |
| 139 | + |
| 140 | +## Platform-Specific Settings |
| 141 | + |
| 142 | +### macOS 15 Network Configuration |
| 143 | + |
| 144 | +On macOS 15, if you experience network connectivity issues, you may need to manually configure the network subnet: |
| 145 | + |
| 146 | +```bash |
| 147 | +defaults write com.apple.container.defaults network.subnet 192.168.66.1/24 |
| 148 | +``` |
| 149 | + |
| 150 | +See the [technical overview](technical-overview.md#macos-15-limitations) for more details about macOS 15 limitations. |
0 commit comments