使用Colima在Apple Silicon上运行Oracle容器镜像

在Apple Silicon(M 系列)Mac上部署Oracle容器存在架构兼容性难题。本教程介绍如何通过Colima 配置 x86_64虚拟机并启用Rosetta支持,轻松在ARM macOS上运行 Oracle数据库镜像。

4 分钟749 字

使用Colima在Apple Silicon上运行Oracle容器镜像数据与中间件 · 4 分钟

oracle 目前不支持 ARM 芯片,所以我们只能通过 colima 来在 ARM macOS 上运行 x86 容器。

Colima 是一个在 macOS 和 Linux 上运行 本地容器虚拟化环境 的工具,它的核心目标是:让你在 非 Linux 系统(特别是 macOS)上运行 Docker 或 containerd 容器,同时比 Docker Desktop 更轻量、更开源。

功能说明
运行 Docker 容器完全兼容 docker 命令(需要配合 Docker CLI)
支持 containerd也可以只用 containerd,适合 K8s 用户
ARM / x86 多架构支持在 ARM Mac 上运行 x86 容器(支持 Rosetta)
高性能挂载支持 virtiofs 挂载,比 sshfs 快得多
可配置资源自由设置 CPU、内存、磁盘、挂载点等
完全免费无许可证限制(对比 Docker Desktop)

#安装 colima

shellshell折叠展开
$ brew install colima$ brew install qemu$ brew install lima-additional-guestagents

需要安装 qemu 和 lima-additional-guestagents,不然会报错:

shellshell折叠展开
$ colima start --memory 8 --arch x86_64WARN[0000] Failed to resolve the guest agent binary for "x86_64"  error="guest agent binary could not be found for Linux-x86_64 (Hint: try installing `lima-additional-guestagents` package)"WARN[0000] Failed to resolve the guest agent binary for "armv7l"  error="guest agent binary could not be found for Linux-armv7l (Hint: try installing `lima-additional-guestagents` package)"WARN[0000] Failed to resolve the guest agent binary for "ppc64le"  error="guest agent binary could not be found for Linux-ppc64le (Hint: try installing `lima-additional-guestagents` package)"WARN[0000] Failed to resolve the guest agent binary for "riscv64"  error="guest agent binary could not be found for Linux-riscv64 (Hint: try installing `lima-additional-guestagents` package)"WARN[0000] Failed to resolve the guest agent binary for "s390x"  error="guest agent binary could not be found for Linux-s390x (Hint: try installing `lima-additional-guestagents` package)" INFO[0000] starting colimaINFO[0000] runtime: dockerFATA[0003] error starting vm: qemu is required to emulate x86_64: qemu-img not found, run 'brew install qemu' to install

#启动 colima

shellshell折叠展开
$ colima start --arch x86_64 --vm-type=vz --vz-rosetta # 可以查看虚拟机情况$ colima statusINFO[0000] colima is running using macOS Virtualization.FrameworkINFO[0000] arch: x86_64INFO[0000] runtime: dockerINFO[0000] mountType: virtiofsINFO[0000] socket: unix:///Users/vitah/.colima/default/docker.sock
参数含义说明
colima start启动(或创建)一个 Colima 虚拟机实例会自动拉起 Docker 或 containerd 容器运行时环境
--arch x86_64设置虚拟机的 CPU 架构为 x86_64(也叫 amd64)适用于运行 仅支持 Intel 架构的容器(如 Oracle 数据库官方镜像)
--vm-type=vz使用 macOS 原生虚拟化框架 Virtualization.framework(简称 vz)相比默认的 QEMU 更快更省资源,仅 macOS 12+ 支持
--vz-rosetta启用 Rosetta 2 翻译支持,让 ARM Mac 能运行 x86_64 Linux 程序仅在使用 --vm-type=vz 且 Mac 是 Apple Silicon(M1/M2/M3)时有效

启动结果:

shellshell折叠展开
$ colima start --arch x86_64 --vm-type=vz --vz-rosetta INFO[0000] starting colimaINFO[0000] runtime: dockerINFO[0002] creating and starting ...                     context=vmINFO[0066] provisioning ...                              context=dockerINFO[0073] starting ...                                  context=dockerINFO[0163] done

#oracle 镜像

接下来就是 docker 启动 oracle 镜像。

创建容器:

shellshell折叠展开
$ docker login # 下载镜像$ docker pull oracleinanutshell/oracle-xe-11g # 启动容器$ docker run -d --name oracle_11g -p 127.0.0.1:1521:1521 oracleinanutshell/oracle-xe-11g# oracle的默认用户是system,密码是oracle

#参考链接

END · 2026.02.04
RabbitMQ的使用分布式系统 · 10 分钟
上一篇 · 更早

RabbitMQ的使用

2026.02.04 · 10 分钟
你可能也想读
macOS上docker启动SQL Server2026.02.04 · 1 分钟↗Redis网络层从硬编码到优雅的connListener抽象2026.09.17 · 16 分钟↗20亿手机号存储选择int还是string2026.02.13 · 3 分钟↗
林
VitahLin

后端工程师 · 写长文
VitahLin 的个人博客,记录经济观察、股票研究,以及后端开发、分布式系统、数据库与 Redis 的原理和工程实践。