Docker工具箱不能分配内存

我试图让Docker在我的Mac上本地运行一个容器,我一直在云中工作。 我做了docker提交/保存/加载查找。 但是当我在安装docker工具箱后在本地运行它时,出现这个错误

docker logs es-loaded-with-data Java HotSpot(TM) 64-Bit Server VM warning: INFO: os::commit_memory(0x00000006c5330000, 4207738880, 0) failed; error='Cannot allocate memory' (errno=12) Starting elasticsearch: # # There is insufficient memory for the Java Runtime Environment to continue. # Native memory allocation (mmap) failed to map 4207738880 bytes for committing reserved memory. # An error report file with more information is saved as: # //hs_err_pid16.log Java HotSpot(TM) 64-Bit Server VM warning: INFO: os::commit_memory(0x00000006c5330000, 4207738880, 0) failed; error='Cannot allocate memory' (errno=12) Starting elasticsearch: # 

如果我做docker info然后我得到

总内存:1.956 GiB

显然2 Gb是不够的。 我该如何增加容器才能运行?

Mac OS上的Docker运行在具有docker-machine(或更老的boot2docker)的virtualbox VM中。 我不确定docker-machine是否支持直接修改VM RAM,但是你可以直接启动VirtualBox.app并直接修改VM内存的数量。 重新启动VM等。