我想轻松连接我的壳泊坞窗,我可以通过输入以下命令这样做:shell脚本连接到泊坞窗守护
eval "$(docker-machine env docker-vm)"
我想我会把这条线在一个简单的shell脚本。我发现,尽管命令通过在bash提示符处键入该行来工作,但如果放置在shell脚本中然后执行该脚本,该行将不起作用。运行脚本后,我将收到错误:Cannot connect to the Docker daemon. Is the docker daemon running on this host?
我正在使用oh-my-zsh和iterm2。
这里是小脚本拿到机器的运行:
#!/usr/bin/env bash
docker-machine start docker-vm
docker-machine ip docker-vm
docker-machine env docker-vm
# this line will not "execute" meaning it does not work from the script
# this line does work proerly when executed from the command line
eval "$(docker-machine env docker-vm)"
请更具体比'不工作'。你观察到什么行为?有没有错误信息? –
试试这个:https://github.com/docker/machine/issues/1786。 'eval“$(docker-machine env --shell bash docker-vm)”' –
这看起来像是在1.8中修复的。我使用的是docker 1.9。 --shell bash除了没有效果。 – Iannazzi