简体   繁体   中英

FATA[0000] Get http:///var/run/docker.sock/v1.17/version: dial unix /var/run/docker.sock

I install docker using this guide . I'm using

Distributor ID: Ubuntu
Description:    Ubuntu 13.10
Release:    13.10
Codename:   saucy

Even though I excetly followed the steps given I get below error when I issue docker version command.

Client version: 1.5.0
Client API version: 1.17
Go version (client): go1.4.1
Git commit (client): a8a31ef
OS/Arch (client): linux/amd64
FATA[0000] Get http:///var/run/docker.sock/v1.17/version: dial unix /var/run/docker.sock: no such file or directory. Are you trying to connect to a TLS-enabled daemon without TLS?

I aleardy referred below, but it does not work for me. Most of the them focus on Mac OS X

Installing a web application in a Docker container: dial unix /var/run/docker.sock: no such file or directory

docker error: /var/run/docker.sock: no such file or directory

Am I trying to connect to a TLS-enabled daemon without TLS?

How can I fix this?

Please see the O/P below

INFO[0000] +job serveapi(unix:///var/run/docker.sock)   
INFO[0000] Listening for HTTP on unix (/var/run/docker.sock) 
DEBU[0000] Registering POST, /containers/{name:.*}/resize 
DEBU[0000] Registering POST, /containers/create         
DEBU[0000] Registering POST, /containers/{name:.*}/kill 
DEBU[0000] Registering POST, /containers/{name:.*}/start 
DEBU[0000] Registering POST, /containers/{name:.*}/stop 
DEBU[0000] Registering POST, /containers/{name:.*}/copy 
DEBU[0000] Registering POST, /containers/{name:.*}/exec 
DEBU[0000] Registering POST, /exec/{name:.*}/start      
DEBU[0000] Registering POST, /auth                      
DEBU[0000] Registering POST, /build                     
DEBU[0000] Registering POST, /containers/{name:.*}/wait 
DEBU[0000] Registering POST, /containers/{name:.*}/attach 
DEBU[0000] Registering POST, /images/{name:.*}/tag      
DEBU[0000] Registering POST, /containers/{name:.*}/pause 
DEBU[0000] Registering POST, /containers/{name:.*}/rename 
DEBU[0000] Registering POST, /commit                    
DEBU[0000] Registering POST, /images/create             
DEBU[0000] Registering POST, /images/load               
DEBU[0000] Registering POST, /images/{name:.*}/push     
DEBU[0000] Registering POST, /containers/{name:.*}/unpause 
DEBU[0000] Registering POST, /containers/{name:.*}/restart 
DEBU[0000] Registering POST, /exec/{name:.*}/resize     
DEBU[0000] Registering DELETE, /containers/{name:.*}    
DEBU[0000] Registering DELETE, /images/{name:.*}        
DEBU[0000] Registering OPTIONS,                         
DEBU[0000] Registering GET, /containers/{name:.*}/json  
DEBU[0000] Registering GET, /events                     
DEBU[0000] Registering GET, /images/search              
DEBU[0000] Registering GET, /images/get                 
DEBU[0000] Registering GET, /images/{name:.*}/get       
DEBU[0000] Registering GET, /images/{name:.*}/history   
DEBU[0000] Registering GET, /containers/json            
DEBU[0000] Registering GET, /containers/{name:.*}/export 
DEBU[0000] Registering GET, /info                       
DEBU[0000] Registering GET, /images/viz                 
DEBU[0000] Registering GET, /containers/{name:.*}/top   
DEBU[0000] Registering GET, /containers/{name:.*}/logs  
DEBU[0000] Registering GET, /containers/{name:.*}/stats 
DEBU[0000] Registering GET, /exec/{id:.*}/json          
DEBU[0000] Registering GET, /_ping                      
DEBU[0000] Registering GET, /images/json                
DEBU[0000] Registering GET, /images/{name:.*}/json      
DEBU[0000] Registering GET, /containers/{name:.*}/attach/ws 
DEBU[0000] Registering GET, /version                    
DEBU[0000] Registering GET, /containers/ps              
DEBU[0000] Registering GET, /containers/{name:.*}/changes 
DEBU[0000] docker group found. gid: 999                 
DEBU[0000] Using graph driver aufs                      
DEBU[0000] Migrating existing containers                
DEBU[0000] Creating images graph                        
DEBU[0000] Restored 0 elements                          
DEBU[0000] Creating repository list                     
INFO[0000] +job init_networkdriver()                    
DEBU[0000] /sbin/iptables, [--wait -C POSTROUTING -t nat -s 172.17.42.1/16 ! -o docker0 -j MASQUERADE] 
DEBU[0000] /sbin/iptables, [--wait -D FORWARD -i docker0 -o docker0 -j DROP] 
DEBU[0000] /sbin/iptables, [--wait -C FORWARD -i docker0 -o docker0 -j ACCEPT] 
DEBU[0000] /sbin/iptables, [--wait -C FORWARD -i docker0 ! -o docker0 -j ACCEPT] 
DEBU[0000] /sbin/iptables, [--wait -C FORWARD -o docker0 -m conntrack --ctstate RELATED,ESTABLISHED -j ACCEPT] 
DEBU[0000] /sbin/iptables, [--wait -t nat -D PREROUTING -m addrtype --dst-type LOCAL -j DOCKER] 
DEBU[0000] /sbin/iptables, [--wait -t nat -D OUTPUT -m addrtype --dst-type LOCAL ! --dst 127.0.0.0/8 -j DOCKER] 
DEBU[0000] /sbin/iptables, [--wait -t nat -D OUTPUT -m addrtype --dst-type LOCAL -j DOCKER] 
DEBU[0000] /sbin/iptables, [--wait -t nat -D PREROUTING -j DOCKER] 
DEBU[0000] /sbin/iptables, [--wait -t nat -D OUTPUT -j DOCKER] 
DEBU[0000] /sbin/iptables, [--wait -t nat -F DOCKER]    
DEBU[0000] /sbin/iptables, [--wait -t nat -X DOCKER]    
DEBU[0000] /sbin/iptables, [--wait -t nat -n -L DOCKER] 
DEBU[0000] /sbin/iptables, [--wait -t nat -N DOCKER]    
DEBU[0000] /sbin/iptables, [--wait -C -m addrtype --dst-type LOCAL] 
DEBU[0000] /sbin/iptables, [--wait -t nat -A PREROUTING -m addrtype --dst-type LOCAL -j DOCKER] 
DEBU[0000] /sbin/iptables, [--wait -C -m addrtype --dst-type LOCAL ! --dst 127.0.0.0/8] 
DEBU[0000] /sbin/iptables, [--wait -t nat -A OUTPUT -m addrtype --dst-type LOCAL ! --dst 127.0.0.0/8 -j DOCKER] 
DEBU[0000] /sbin/iptables, [--wait -t filter -n -L DOCKER] 
DEBU[0000] /sbin/iptables, [--wait -C FORWARD -o docker0 -j DOCKER] 
INFO[0000] -job init_networkdriver() = OK (0)           
INFO[0000] WARNING: Your kernel does not support cgroup swap limit. 
DEBU[0000] Restarting containers...                     
INFO[0000] docker daemon: 1.5.0 a8a31ef; execdriver: native-0.2; graphdriver: aufs 
INFO[0000] +job acceptconnections()                     
INFO[0000] -job acceptconnections() = OK (0)            
DEBU[0022] Calling GET /version                         
INFO[0022] GET /v1.17/version                           
INFO[0022] +job version()                               
INFO[0022] -job version() = OK (0)

我在Ubuntu 14.04(3.13.0-39-generic)上遇到了类似的问题解决方案是:

sudo apt-get install apparmor

service docker restart

The problem is that your user has not been added to the docker group.

Try:

sudo usermod -a -G docker <uname>

If you don't want to log in/out from your current shell, run:

newgrp docker

This error is because you have not started the docker service. Once you start the service it creates /var/run/docker.sock and then the error is resolved.

sudo service docker start

Then you can see if the installation is proper or not by sudo docker info .

I have Ubuntu 14.04,3.16.0-33-generic. These steps worked for me:

1) Install docker

wget -qO- https://get.docker.com/ | sh

2) Add your user to docker group:

sudo usermod -aG docker "username"

3) Reboot. I don't know if there is a simple way to avoid reboot.

Before rebooting, nothing of this post nor others worked for me

1) create a docker group

sudo groupadd docker

2) add <enter_username> to the created docker group

sudo usermod -aG docker <enter_username>

3) reboot the system

sudo reboot

4) verify whether running the command using sudo is not required anymore

Executing: docker run hello-world should result in:

[user@host ~]$ docker run hello-world

Hello from Docker.
This message shows that your installation appears to be working correctly.

To generate this message, Docker took the following steps:
 1. The Docker client contacted the Docker daemon.
 2. The Docker daemon pulled the "hello-world" image from the Docker Hub.
 3. The Docker daemon created a new container from that image which runs the
    executable that produces the output you are currently reading.
 4. The Docker daemon streamed that output to the Docker client, which sent it
    to your terminal.

To try something more ambitious, you can run an Ubuntu container with:
 $ docker run -it ubuntu bash

Share images, automate workflows, and more with a free Docker Hub account:
 https://hub.docker.com

For more examples and ideas, visit:
 https://docs.docker.com/userguide/

Reference

Create a docker group

在此处输入图片说明

When you first install you'll need to use sudo as docker needs to bind to a Unix socket which is owned by root:

sudo docker version

if you still get an error, check the service is running:

sudo service docker start

If you want to avoid using sudo try creating and adding yourself to a docker group.

sudo usermod -a -G docker <username>

To activate this change either do, newgrp docker , logout/login or restart your machine. If using newgrp docker , you might need to also restart the docker daemon. ( sudo service docker restart ) (Note though that the docker group is equivalent to root...)

(AppArmor my work as it restricts all application access, I have no idea how it would effect Docker)

Docker manual is helpful. Sometimes.

On OS X, boot2docker up outputs:

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

Executing these commands solved the problem for me.

On Fedora 21 I had the same issue. I had installed as sudo su . After I ran service docker restart all was well.

I got an error with docker and @mrother's answer really works. May be the problem is different, so I just put this for someone's information. I am new here and cannot add comment or vote, so I have to add an answer. The problem is as follows:

$ docker info

$ FATA[0000] Get http:///var/run/docker.sock/v1.18/info : dial unix /var/run/docker.sock: no such file or directory. Are you trying to connect to a TLS-enabled daemon without TLS?

So I checked docker daemon with ps aux|grep docker and found none.

So I run docker -d mannully and got this:

FATA[0000] Shutting down daemon due to errors: Error loading docker apparmor profile: exit status 1 (Feature buffer full.)

then sudo apt-get install apparmor fixed this problem.

请遵循以下解决方案:

sudo chmod -R 777 docker.sock

在Mac 10.9.5上,什么可以帮助我运行:

eval "$(boot2docker shellinit)"
  1. Stop docker daemon
  2. sudo rm /var/lib/docker/network/files/local-kv.db
  3. Start docker daemon

Read more: https://github.com/docker/docker/issues/17846

I had this on ubuntu 14.04: FATA[0000] Post http:///var/run/docker.sock/v1.18/containers/create : dial unix /var/run/docker.sock: permission denied. Are you trying to connect to a TLS-enabled daemon without TLS?

I tried:

  1. sudo usermod -a -G docker yourusername
  2. restart shell

This worked for me.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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