Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

docker

I'm trying to learn about Docker, but I keep getting cryptic (to me) error messages.

Possibly the simplest example of this is trying to print the version of Docker I installed:

$ sudo docker version
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
FATA[0000] Get http:///var/run/docker.sock/v1.16/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've just been going through the user guide and following every step exactly, so I'm surprised that I get this message... What should I do now?

I just noticed that if I don't use sudo I don't get the error:

$ docker version
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

Of course, this is not a solution as I may need to use sudo somewhere down the road...

I just found another page saying "If you're using OS X then you shouldn't use sudo." I don't know if they mean only for that example, or in general.

like image 478
Shawn Avatar asked Oct 19 '22 00:10

Shawn


2 Answers

For me, running $(boot2docker shellinit 2> /dev/null) fixed the problem.

This runs the output of the boot2docker shellinit command (the three set -x ... lines) in your current terminal session, which lets the docker command know where to find the boot2docker virtual machine.

Adding $(boot2docker shellinit 2> /dev/null) to the bottom of your ~/.bash_profile file will make sure the docker command is configured, every time you open your terminal.


For people using Fish shell: boot2docker shellinit ^ /dev/null | source.


Note that 2> /dev/null (and the Fish equivalent ^ /dev/null) are optional. Like @pablo-fernandez suggested, this hides the Writing .. lines.

like image 150
mauvm Avatar answered Oct 20 '22 12:10

mauvm


I was getting the same error on MacOS with sudo and without it.

I have solved it with:

boot2docker start
$(boot2docker shellinit)

P.S.: Thanks to Alan. I found out that this approach is recommended in their official documentation.

P.S.2: Sometimes boot2docker init can be required before running two commands (thank you Aaron).

like image 79
Salvador Dali Avatar answered Oct 20 '22 12:10

Salvador Dali