Resolve fish: Unknown command 'export' when executing docker-machine env

Aug 23, 2017 Docker 中文版

I like to use Fish shell and Docker while developing, and I believe there are some people also like the combination. But you might encounter some problems caused by Fish’s design. Like this one fish: Unknown command ‘export’ when running eval (docker-machine env your-machine). Thus, this post is about how to resolve it.



Resolve fish: Unknown command ‘export’

To solve it, you have to learn how does Fish set shell variables. Fish is not like other shells. It uses set instead of export. For example:

set -x [variable-name] [variable-value]

And this is what you get when running docker-machine env your-machine:

export DOCKER_TLS_VERIFY="1"
export DOCKER_HOST="tcp://100.100.100.100:2376"
export DOCKER_CERT_PATH="/path/to/your/machine"
export DOCKER_MACHINE_NAME="your-machine"

Apparently, Fish doesn’t recognize the export command, so it throws error message. Fortunately, docker-machine provides a solution for us and that is to use shell option:

eval (docker-machine env your-machine --shell=fish)

Now, you should be able to set the variables.


You might also like:




If you have any suggestions, questions or even find some typos, feel free to contact me. Thank you! :)

zeckli.devforgalaxy@gmail.com   © 2015-2019 zeckli, thanks to Jekyll and GitHub.