简体   繁体   English

Docker错误拨号unix /var/run/docker.sock:没有这样的文件或目录

[英]Docker error dial unix /var/run/docker.sock: no such file or directory

I use to have boot2docker installed but recently installed the Docker ToolBox app for the Mac (running 10.11). 我用来安装boot2docker但是最近为Mac安装了Docker ToolBox应用程序(运行10.11)。 When I open up iTerm and type docker ps I get the following message. 当我打开iTerm并键入docker ps我收到以下消息。

Get http:///var/run/docker.sock/v1.20/containers/json: dial unix /var/run/docker.sock: no such file or directory.
* Are you trying to connect to a TLS-enabled daemon without TLS?
* Is your docker daemon up and running?

I use to use boot2docker so I assumed the ToolBox is now needed. 我用来使用boot2docker所以我假设现在需要ToolBox。 I started the app Docker quick start terminal which works only inside their terminal. 我启动了应用程序Docker quick start terminal ,它只在终端内部工作。 However, I want to use docker in my own terminal etc. 但是,我想在我自己的终端等中使用docker。

Why do I get this error? 为什么我会收到此错误? How to fix? 怎么修?

The docker toolbox now uses docker-machine to create docker hosts. docker工具箱现在使用docker-machine创建docker主机。 The error you're seeing is likely because you did not set an active machine. 您看到的错误可能是因为您没有设置活动计算机。

First make sure you have a docker host running with docker-machine ls . 首先确保你有一个使用docker-machine ls运行的docker主机。 Then set an active machine with 然后设置一个活动的机器

eval $(docker-machine env default)

Where default is the name of the machine from the ls output. 其中default是ls输出中机器的名称。

I created a quick and dirty helper you can use to show your currently active machine in your prompt if you like: https://gist.github.com/aburnett/1165239cd2673a43579c 我创建了一个快速而又脏的帮助程序,如果您愿意,可以在提示符中显示当前活动的计算机: https//gist.github.com/aburnett/1165239cd2673a43579c

Edit: You will probably want to use Adam B's answer as docker-machine is the standard way of handling "remote" docker engines now. 编辑:你可能想要使用Adam B的答案,因为docker-machine是现在处理“远程”docker引擎的标准方法。 Thanks for pointing this out Adam B. 感谢你指出Adam B.

Eg eval $(docker-machine env default) 例如eval $(docker-machine env default)

Original answer: 原始答案:

On OS X the Docker Engine runs inside a virtual machine (most commonly Virtualbox). 在OS X上,Docker Engine在虚拟机(最常见的是Virtualbox)中运行。 To enable communication with this Docker Engine the Docker quick start terminal sets a couple of environment variables that tells the docker binary on your OS X installation to use the Virtualbox-hosted Docker Engine. 为了与此Docker引擎进行通信,Docker快速启动终端设置了几个环境变量,告知OS X安装中的docker二进制文件使用Virtualbox托管的Docker Engine。

$ export DOCKER_TLS_VERIFY="1"
$ export DOCKER_HOST="tcp://ip.of.virtual.machine:2376"
$ export DOCKER_CERT_PATH="/path/to/certificates/"

I'm not on my Mac now and don't remember the exact values used. 我现在不在我的Mac上,也不记得使用的确切值。 The same set of environment variables will be set when opening the Docker CLI tools from the Kitematic gui. 从Kitematic gui打开Docker CLI工具时,将设置相同的环境变量集。

If you can find out the commands and values being used you can add these three commands to the bottom of your .bashrc , .zshrc , or equivalent terminal configuration file and restarting or sourcing ( source ~/.bashrc ) the configuration file. 如果您可以找到正在使用的命令和值,您可以将这三个命令添加到.bashrc.zshrc或等效终端配置文件的底部,然后重新启动或获取( source ~/.bashrc )配置文件。

This will cause the docker binary to use the boot2docker virtualbox docker engine by default even when you don't open your terminal through the Docker Toolbox tools (Kitematic etc). 即使您没有通过Docker Toolbox工具(Kitematic等)打开终端,这也会导致docker二进制文件默认使用boot2docker virtualbox docker引擎。

It can depend on the shell you are using (for instance, fish shell would only be supported in docker toolbox 1.8.2a ) 它可能取决于您使用的shell(例如, 仅在docker工具箱1.8.2a中支持fish shell

Issue 138 tried: 问题138尝试:

  1. Deleted anything in the system that mentions docker. 删除系统中提到docker的任何内容。
  2. Installed toolbox 1.8.1c. 已安装的工具箱1.8.1c。
  3. Ran the Docker Quickstart Terminal (which failed). 跑Docker快速启动终端(失败)。
  4. Deleted ~/.docker 删除了〜/ .docker
  5. Installed docker using 安装码头工具使用

Check also the permission on ~/.docker . 检查~/.docker的权限

暂无
暂无

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

相关问题 Jenkins拨打Unix /var/run/docker.sock:连接:权限被MacOS拒绝 - Jenkins dial unix /var/run/docker.sock: connect: permission denied MacOS Jenkins/MacOS - 拨打 unix /var/run/docker.sock: connect:permission denied - Jenkins/ MacOS - dial unix /var/run/docker.sock: connect:permission denied OS X上没有/var/run/docker.sock - No /var/run/docker.sock on OS X docker:来自守护程序的错误响应:拨打 unix docker.raw.sock:连接:没有这样的文件或目录。 苹果系统 - docker: Error response from daemon: dial unix docker.raw.sock: connect: no such file or directory. MacOS macOS - docker:无法连接到 unix:///var/run/docker.sock 的 Docker 守护程序。 docker 守护程序是否正在运行? - macOS - docker: Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running? 如何以非 root 用户身份从 docker 容器内部访问 /var/run/docker.sock? (MacOS 主机) - How to access /var/run/docker.sock from inside a docker container as a non-root user? (MacOS Host) 在容器内 chowning 主机绑定的 `docker.sock` 会破坏主机 docker - chowning the host's bound `docker.sock` inside container breaks host docker Docker mysql: ERROR 2002 (HY000): Can't connect to local MySQL server through socket'/var/run/mysqld/Macsock' (mysqld.2) - Docker mysql: ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2) on Mac 尝试创建钥匙串“ UNIX [无此文件或目录]时出错 - Error trying to create a keychain "UNIX[No such file or directory] Docker:无法读取 CA 证书:没有这样的文件或目录 - Docker: Could not read CA certificate: no such file or directory
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM