bash 如何撤消命令 $ eval "$(docker-machine env blog)"

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/30550742/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-18 13:05:33  来源:igfitidea点击:

How do I undo the command $ eval "$(docker-machine env blog)"

bashdockerdocker-machine

提问by JAstuccio

I think that command redirected $ dockercommands to the docker machine. Now all my docker commands are giving me an error FATA[0000] Couldn't read ca cert...follwed by the path to the docker-machine I created. How can I fix my shell?

我认为该命令将$ docker命令重定向到 docker 机器。现在我所有的 docker 命令都给我一个错误FATA[0000] Couldn't read ca cert...,然后是我创建的 docker-machine 的路径。如何修复我的外壳?

回答by David Gageot

What you are looking for is:

您正在寻找的是:

eval "$(docker-machine env -u)"

It will unset the DOCKER_*variables.

它将取消设置DOCKER_*变量。

For the record, here's the output of docker-machine env -u:

为了记录,这里是输出docker-machine env -u

unset DOCKER_TLS_VERIFY
unset DOCKER_HOST
unset DOCKER_CERT_PATH
unset DOCKER_MACHINE_NAME

回答by alisianoi

You could also restart your shell. This will drop the variables that minkube docker-envexports.

您也可以重新启动您的外壳。这将删除minkube docker-env导出的变量。

回答by JAstuccio

I had been searching for an answer to this for quite awhile. Shortly after posting the question on stackoverflow I realized typing in to the terminal the export commands docker gives on startup resolved my issue.

我一直在寻找这个问题的答案很长一段时间。在stackoverflow上发布问题后不久,我意识到在终端中输入docker在启动时给出的导出命令解决了我的问题。

To connect the Docker client to the Docker daemon, please set:
export DOCKER_HOST=tcp:// some IP address
export DOCKER_CERT_PATH= some file path
export DOCKER_TLS_VERIFY=1

回答by knil4_crack

I can see that this is an old post but if someone else runs into this issue, who is new to docker like me this can help. By typing:

我可以看到这是一个旧帖子,但是如果其他人遇到这个问题,像我这样的 docker 新手这可以提供帮助。通过键入:

eval $(docker-machine env nameOfVm) 

you are setting your current shell to use docker in that docker-machine. You can check if you type docker-machine lsthat under active tab, that status is changed from - to *for that machine. You can also check which machine is active by running docker-machine active.

您正在设置当前的 shell 以在该 docker-machine 中使用 docker。您可以检查您docker-machine ls是否在活动选项卡下键入,- to *该机器的状态已更改。您还可以通过运行来检查哪台机器处于活动状态docker-machine active

If you want to undo eval, just run:

如果要撤消 eval,只需运行:

eval $(docker-machine env -u)

and it will unset variables for active machine (You don't have to specify the name of the machine). This is all under macOS but I think it should be same on linux as well. You can read more about this here: Docker documentation: docker-machine env

它将取消活动机器的变量设置(您不必指定机器的名称)。这都是在 macOS 下,但我认为在 linux 上也应该是一样的。您可以在此处阅读更多相关信息: Docker 文档:docker-machine env