我正在尝试在Docker容器中安装一个Web应用程序。
我使用的是OS X Yosemite 10.10.1版本。
我一直在按照Dockerizing a Node.js Web App教程操作,链接在此:https://docs.docker.com/examples/nodejs_web_app/
我下载并设置了boot2docker osx-installer,地址为:github.com/boot2docker/osx-installer/releases/tag/v1.4.1
我依次在控制台中输入了以下命令:
$ boot2docker init $ boot2docker start $ (boot2docker shellinit)
然后,按照终端指示,我使用以下命令设置环境变量:
$ export DOCKER_TLS_VERIFY=1 $ export DOCKER_HOST=tcp://192.168.59.103:2376 $ export DOCKER_CERT_PATH=/Users/myusername/.boot2docker/certs/boot2docker-vm
到这里,一切似乎都正常。
接下来,按照Dockerizing a Node.js app的教程,我执行到这个步骤:https://docs.docker.com/examples/nodejs_web_app/#building-your-image,输入以下命令:
$ sudo docker build -t <your username>/centos-node-hello .
然后它要求我输入密码,但是在输入密码后,我一直收到以下错误信息:
Sending build context to Docker daemon FATA[0000] Post http:///var/run/docker.sock/v1.16/build?rm=1&t=myusername%2Fcentos-node- hello: dial unix /var/run/docker.sock: no such file or directory
这是我的环境变量:
`TERM_PROGRAM=Apple_Terminal
TERM=xterm-256color
SHELL=/bin/bash
TMPDIR=/var/folders/vb/vmd78vk57mqd6fv7sqb544pc0000gn/T/
DOCKER_HOST=tcp://192.168.59.103:2376
Apple_PubSub_Socket_Render=/private/tmp/com.apple.launchd.BBIW525XNA/Render
TERM_PROGRAM_VERSION=343
OLDPWD=/Users/myusername/Desktop
TERM_SESSION_ID=FAD1F3F1-35DF-4183-A47A-08749EAFEACB
USER=myusername
SSH_AUTH_SOCK=/private/tmp/com.apple.launchd.A6ZjHwx8eq/Listeners
__CF_USER_TEXT_ENCODING=0x1F5:0x0:0x0
DOCKER_TLS_VERIFY=1
PATH=/Users/myusername/.rbenv/shims:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/X11/bin
PWD=/Users/myusername/Desktop/docker
LANG=en_CA.UTF-8
vXPC_FLAGS=0x0
XPC_SERVICE_NAME=0
DOCKER_CERT_PATH=/Users/myusername/.boot2docker/certs/boot2docker-vm
HOME=/Users/myusername
SHLVL=1
LOGNAME=myusername
DISPLAY=/private/tmp/com.apple.launchd.IesbS7VdCy/org.macosforge.xquartz:0
SECURITYSESSIONID=186a5
_=/usr/bin/env`
我的 Docker 版本:
`Client version: 1.4.1
Client API version: 1.16
Go version (client): go1.3.3
Git commit (client): 5bc2ff8
OS/Arch (client): darwin/amd64
Server version: 1.4.1
Server API version: 1.16
Go version (server): go1.3.3
Git commit (server): 5bc2ff8`
非常感谢您的帮助。谢谢。