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

后端 未结 5 1276
一个人的身影
一个人的身影 2021-02-01 17:47

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.

相关标签:
5条回答
  • 2021-02-01 17:51

    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
    
    0 讨论(0)
  • 2021-02-01 17:59

    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
    
    0 讨论(0)
  • 2021-02-01 18:06

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

    0 讨论(0)
  • 2021-02-01 18:08

    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

    0 讨论(0)
  • 2021-02-01 18:11

    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.

    0 讨论(0)
提交回复
热议问题