Docker hello-world不起作用

前端之家收集整理的这篇文章主要介绍了Docker hello-world不起作用 前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

作业系统:Mac OS X

我安装了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?

要使$docker运行hello-world工作,我需要做什么?

最佳答案
您需要在当前的shell中执行以下操作,而不是运行boot2docker shellinit:

eval "$(boot2docker shellinit)"

boot2docker shellinit命令将所需的导出语句打印为标准输出.这些语句设置用于连接到boot2docker虚拟机的必需环境变量.

通过用eval $()包装boot2docker shellinit的输出,变量将被导出到当前shell中,而不是仅仅打印出来.这应该允许您连接到运行示例所需的boot2docker vm.

原文链接:https://www.f2er.com/docker/532574.html

猜你在找的Docker相关文章