3

Operating System: Mac OS X

I installed boot2docker and started it, some errors are shown:

wangyaos-MBP-2:~ wangyao$ boot2docker start

Waiting for VM and Docker daemon to start...
..........................o
Started.

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

To connect the Docker client to the Docker daemon, please set:
    export DOCKER_TLS_VERIFY=1
    export DOCKER_HOST=tcp://192.168.59.103:2376
    export DOCKER_CERT_PATH=/Users/wangyao/.boot2docker/certs/boot2docker-vm


wangyaos-MBP-2:~ wangyao$ 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

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


wangyaos-MBP-2:~ wangyao$ docker run hello-world

Post http:///var/run/docker.sock/v1.19/containers/create: dial unix /var/run/docker.sock: no such file or directory. Are you trying to connect to a TLS-enabled daemon without TLS?

What do I need to do to make $ docker run hello-world work?

nwinkler
  • 52,665
  • 21
  • 154
  • 168
KingOfSocket
  • 293
  • 5
  • 18
  • 1
    Can you try `eval "$(boot2docker shellinit)"` first? – VonC Jul 07 '15 at 07:02
  • not yet, but i did it just know , there is some new exception. `wangyaos-MBP-2:~ wangyao$ 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 ` – KingOfSocket Jul 07 '15 at 08:22

1 Answers1

3

Instead of running boot2docker shellinit, you need to do the following in your current shell:

eval "$(boot2docker shellinit)"

The boot2docker shellinit command prints the required export statements to standard out. These statements set the required environment variables for connecting to the boot2docker virtual machine.

By wrapping the output of boot2docker shellinit with eval $(), the variables will be exported in the current shell instead of just printed. This should allow you to connect to the boot2docker vm, which is required for running the example.

nwinkler
  • 52,665
  • 21
  • 154
  • 168
  • yeah , i did the command `eval "$(boot2docker shellinit)"`, but there is some new exception , ` wangyaos-MBP-2:~ wangyao$ 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` – KingOfSocket Jul 07 '15 at 08:23
  • Please see this question for an answer to this problem: http://stackoverflow.com/questions/30980474/docker-complains-about-invalid-certificate-after-update-to-v1-7-0 – nwinkler Jul 07 '15 at 08:29