简体   繁体   English

OSX上的Docker:如何在一个shell中启动boot2docker并在另一个shell中使用它

[英]Docker on OSX: How to start boot2docker in one shell and use it in another

After initialising with boot2docker start , only a specific terminal can then use docker commands. 使用boot2docker start初始化后,只有特定终端才能使用docker命令。 No other tabs, no other programs. 没有其他标签,没有其他程序。

In Emacs I'd like to execute the build and run commands in a new process every time they are called upon. 在Emacs中,我想在每次调用时在新进程中执行构建和运行命令。 The fact that I'd have to boot2docker init every single time makes this impossible. 我每次都必须使用boot2docker init这一事实使得这一切变得不可能。

I'm also getting really tired of exporting every single time and I know other people must be extremely frustrated as well, so I'm hoping someone found a solution? 我也非常厌倦每次出口,我知道其他人也一定非常沮丧,所以我希望有人找到解决方案?

if boot2docker is on your path in each shell, then you can 如果boot2docker在你的每个shell的路径上,那么你可以

eval "$(boot2docker shellinit)"

as per https://github.com/boot2docker/boot2docker/blob/master/README.md#tls-support 根据https://github.com/boot2docker/boot2docker/blob/master/README.md#tls-support

First check that the VM is ok to run as far as VT being enabled goes - a surefire way to do this is just to open Virtualbox manually (yes, not very "docker" of me... humph!) and find the VM. 首先检查虚拟机是否可以运行,直到VT被启用为止 - 这样做的一个可靠的方法就是手动打开Virtualbox(是的,不是我的“docker”... humph!)并找到VM。

Sidebar: If you mistakenly ran boot2docker init as root or another user you will see those entries in there too... remove the unneeded VMs? 补充工具栏:如果您错误地以root用户或其他用户身份运行boot2docker init,您也会看到那些条目...删除不需要的VM?

Anyways, look at settings for your boot2docker-vm and see if there is a "hint" at the bottom of the settings window letting you know if something is not configured right. 无论如何,请查看boot2docker-vm的设置,并查看设置窗口底部是否有“提示”,告知您是否配置了正确的内容。

Like, for instance if VT-d isnt enabled, or something like you don't have the right amount of RAM allocated for the VM or the VM's video card. 例如,如果未启用VT-d,或类似的东西,您没有为VM或VM的视频卡分配适当数量的RAM。

Next, start the VM from within Virtualbox. 接下来,从Virtualbox中启动VM。

For me, after I properly adjusted memory settings the last issue was: 对我来说,在我正确调整内存设置后,最后一个问题是:

VT-x is disabled in the BIOS. (VERR_VMX_MSR_VMXON_DISABLED).

So I looked here: 所以我看了一下:

sudo sysctl -a | egrep VMX

machdep.cpu.features: FPU VME DE PSE TSC MSR PAE MCE CX8 APIC SEP MTRR PGE MCA CMOV PAT PSE36 CLFSH DS ACPI MMX FXSR SSE SSE2 SS HTT TM PBE SSE3 DTES64 MON DSCPL VMX SMX EST TM2 SSSE3 CX16 TPR PDCM SSE4.1 XSAVE

So, if you have VMX show up here then you need to enable it in your bios (hackintosh) or you can enable it by updating your EFI firmware or through some other absurd method: 因此,如果您在此处显示VMX,则需要在BIOS(hackintosh)中启用它,或者您可以通过更新EFI固件或通过其他一些荒谬的方法启用它:

https://communities.vmware.com/message/932263 https://communities.vmware.com/message/932263

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM