Can't set docker-machine environment variables bash

I’ using bash 4.3 and I can’t export or set docker-machine environment variables

bash-4.3$ docker-machine env default
set -gx DOCKER_TLS_VERIFY "1";
set -gx DOCKER_HOST "tcp://192.168.99.100:2376";
set -gx DOCKER_CERT_PATH "/Users/ofolorunso/.docker/machine/machines/default";
set -gx DOCKER_MACHINE_NAME "default";
# Run this command to configure your shell: 
# eval (docker-machine env default)

Apparently bash doesn’t recognize the g flag

  • Can I run Docker in a Virtual Machine?
  • Creating docker-consul official image
  • Trouble connecting to MS SQL from Alpine Linux Docker
  • Multiple commands during docker run
  • How to change Docker ENV var?
  • Laravel application CI with Docker & Gitlab [closed]
  • bash-4.3$ eval "$(docker-machine env default)"
    bash: set: -g: invalid option
    set: usage: set [-abefhkmnptuvxBCHP] [-o option-name] [--] [arg ...]
    bash: set: -g: invalid option
    set: usage: set [-abefhkmnptuvxBCHP] [-o option-name] [--] [arg ...]
    bash: set: -g: invalid option
    set: usage: set [-abefhkmnptuvxBCHP] [-o option-name] [--] [arg ...]
    bash: set: -g: invalid option
    set: usage: set [-abefhkmnptuvxBCHP] [-o option-name] [--] [arg ...]
    

    I should note that my machine’s default shell is fish

  • Using network_mode='host' in docker-compose break run: host type networking can't be used with links
  • Installed docker and ran a container with mongodb, now brew's mongodb isn't working
  • Trying to push an image to the docker registry
  • How do you do an ElasticBeanstalk deploy for multiple docker containers?
  • Getting User name + password to docker container
  • Checking container connectivity with ping in a Calico network of Docker containers
  • 2 Solutions collect form web for “Can't set docker-machine environment variables bash”

    Have you tried forcing bash with the --shell option?

    docker-machine env --shell bash default
    export DOCKER_TLS_VERIFY="1"
    export DOCKER_HOST "tcp://192.168.99.100:2376"
    export DOCKER_CERT_PATH "/Users/ofolorunso/.docker/machine/machines/default"
    export DOCKER_MACHINE_NAME="default"
    

    Env variables are set with set -gx in fish and with export in bash.

    Set has no flag -g in bash. I do not know what you’re trying to do with those flags, but if you want to set environment or shell variables, look at this.

    For example, to set a variable use something like this: export ANT_HOME=/path/to/ant/dir

    Docker will be the best open platform for developers and sysadmins to build, ship, and run distributed applications.