How to export the docker variables?

I’m new to docker.My Operating system is Mac OS.
I follow the step from docker website,

  1. Download the boot2docker and install it.
  2. run the boot2docker
  3. $ boot2docker init
  4. $ boot2docker start
  5. $ docker run hello-world

the result is that :

  • Running a Docker container with the -p or -P flag causes it to fail
  • Artifactory exception : There should be 10 default repository layouts
  • MongoDB “Unable to establish lock” error on mounted drive using Docker and Lustre
  • How to add self gem files to Dockerfile if use official docker rails image?
  • Can I mount docker host directory as copy on write/overlay?
  • docker-compose scale service with independent volumes
  • bash-3.2$ docker run hello-world
    

    An error occurred trying to connect: Post https://192.168.59.103:2376/v1.19/containers/create: x509: certificate is valid for 127.0.0.1, 10.0.2.15, not 192.168.59.103

    then i do

    $ boot2docker shellinit to display the environment variables

    bash-3.2$ boot2docker shellinit

    Writing /Users/wangyao/.boot2docker/certs/boot2docker-vm/ca.pem

    Writing /Users/wangyao/.boot2docker/certs/boot2docker-vm/cert.pem

    Writing /Users/wangyao/.boot2docker/certs/boot2docker-vm/key.pem

    Your environment variables are already set correctly.

    maybe I think it makes error by not configuring the variables, So I do this

    export DOCKER_HOST=tcp://192.168.59.103:2376
    export DOCKER_CERT_PATH=/Users/wangyao/.boot2docker/certs/boot2docker-vm
    export DOCKER_TLS_VERIFY=1
    

    then I $ boot2docker shellinit, and the result is no different,

    Please tell me how to resolve it

  • Docker hello-world: authentication error
  • Bad docker tag got daemon stuck
  • Running installer within docker file without user interaction
  • Docker container and memory consumption
  • Setting up failover for dockerized Zabbix instances (not Docker Swarm)
  • Grep/Awk: Find status from table column
  • One Solution collect form web for “How to export the docker variables?”

    I explained how to use Docker Machine instead of boot2docker, if you’re interested: Can't run docker on os X with boot2docker.

    Because I think Boot2Docker won’t be the recommended way of using Docker (on Windows/OS X) any longer soon.

    TL;DR

    docker-machine create -d virtualbox dev
    eval "$(docker-machine env dev)"
    docker run hello-world
    
    Docker will be the best open platform for developers and sysadmins to build, ship, and run distributed applications.