简体   繁体   English

Docker hello-world不起作用

[英]Docker hello-world does not work

Operating System: Mac OS X 操作系统:Mac OS X.

I installed boot2docker and started it, some errors are shown: 我安装了boot2docker并启动它,显示了一些错误:

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? 我需要做些什么来让$ docker run hello-world工作?

Instead of running boot2docker shellinit , you need to do the following in your current shell: 您需要在当前shell中执行以下boot2docker shellinit ,而不是运行boot2docker shellinit

eval "$(boot2docker shellinit)"

The boot2docker shellinit command prints the required export statements to standard out. boot2docker shellinit命令将所需的export语句打印到标准输出。 These statements set the required environment variables for connecting to the boot2docker virtual machine. 这些语句设置了连接到boot2docker虚拟机所需的环境变量。

By wrapping the output of boot2docker shellinit with eval $() , the variables will be exported in the current shell instead of just printed. 通过使用eval $()包装boot2docker shellinit的输出,变量将导出到当前shell而不是仅打印。 This should allow you to connect to the boot2docker vm, which is required for running the example. 这应该允许您连接到boot2docker vm,这是运行示例所必需的。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM