Docker error in Linux mint 17

2020-05-21 05:18发布

问题:

I have installed docker in Linux Mint 17 Qiana (which is based on Ubuntu 14.04) present in the Oracle VM. If I tries to start, it shows the following error,

FATA[0000] Get http:///var/run/docker.sock/v1.18/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? 

I couldn't find any useful information regarding this when I tried googling regarding the same. This stackoverflow question suggesting to restart my system, but it doesn't work.

I'm seeing the following related questions which are unhelpful.

/var/run/docker.sock: no such file or directory. Are you trying to connect to a TLS-enabled daemon without TLS?

Docker: Are you trying to connect to a TLS-enabled daemon without TLS?

So, any help on this would be greatly helpful.

回答1:

I don't know how it comes with .deb package (I'm using Fedora), but TLS shouldn't be set by default, so I would suggest following some basic steps to see if it is running correctly.

1. Check if docker daemon is running

ps aux | grep docker
root      4215  0.1  0.1 440156 17332 ?        Ssl  15:48   0:00 /usr/bin/docker -d -D --bip=172.17.42.1/16 --dns=172.17.42.1 --dns-search=docker -s overlay
wololock  8986  0.0  0.0 113024  2304 pts/1    S+   15:50   0:00 /usr/bin/grep docker

I the docker process is not running, try sudo /etc/init.d/docker start or sudo service docker start

2. Check if /var/run/docker.sock exists

ls -la /var/run/docker.*
-rw-r--r--. 1 root root   4 04-23 15:48 /var/run/docker.pid
srw-rw----. 1 root docker 0 04-23 15:48 /var/run/docker.sock

The important part here is that file need to be own by group docker, so you can connect to it without root permissions.

If docker.sock does not exist, you can try running docker from the command line with debug mode on to see what causes the problem:

sudo docker -d -D

3. Check if your user is added to docker group

id -a
uid=1000(wololock) gid=1000(wololock) grupy=1000(wololock),0(root),10(wheel),100(users),977(docker),989(pkg-build)

If you wont find your user in docker group, try adding yourself to it by:

sudo gpasswd -a [username] docker

4. Get the latest docker version

If the previous attempts wont help, try getting the latest docker version from https://docs.docker.com/installation/ubuntulinux/#installing-docker-on-ubuntu I'm not sure, but this line:

FATA[0000] Get http:///var/run/docker.sock/v1.18/containers/json:

suggests that you're using docker v1.18. I might be wrong, but if it's true, this is not the most recent docker version and it should be upgraded. I use currently docker v1.5.0, it works well on Fedora 21

IMPORTANT: UBUNTU / LINUX MINT USERS

The problem we discussed here was caused by missing (or not running) apparmor package in the ubuntu/linuxmint distribution. The easiest way to fix it is to install apparmor:

sudo apt-get install apparmor

If it's installed yet not running, start it with:

sudo service apparmor start
  • https://wiki.ubuntu.com/AppArmor
  • https://github.com/docker/docker/issues/9745

I hope my answer will help you in resolving your problem. If you have any questions, feel free to ask. I will try to help you as much as I can.