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

喜夏-厌秋 提交于 2021-01-20 15:57:36

问题


I think that command redirected $ docker commands 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?


回答1:


What you are looking for is:

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

It will unset the DOCKER_* variables.

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

unset DOCKER_TLS_VERIFY
unset DOCKER_HOST
unset DOCKER_CERT_PATH
unset DOCKER_MACHINE_NAME



回答2:


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




回答3:


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.

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



回答4:


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:

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 ls that 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.

If you want to undo eval, just run:

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




回答5:


All you have to do is run

docker-machine env machine-name

Then, copy and run the last segment in the output to set or remove the env variables.

Which looks like this in Windows :

eval $("C:\Program Files\Docker Toolbox\docker-machine.exe" env machine-name)

If it's set already, docker adds a "-u" at the tail to make the task easy.

like this in Windows :

eval $("C:\Program Files\Docker Toolbox\docker-machine.exe" env -u)

That's all.



来源:https://stackoverflow.com/questions/30550742/how-do-i-undo-the-command-eval-docker-machine-env-blog

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!