Docker Community Forums

Share and learn in the Docker community.

How to let docker to listen to the default socket instead of any TCP port


(Reachchinu) #1

Hello all,

I am beginner to Docker. When i insert the following cmd it shows that it is stopped.
cmd: sudo service docker status
output: “docker stop/waiting”

But when i enter following command
cmd: docker version
output:
lient version: 1.6.2
Client API version: 1.18
Go version (client): go1.4.2
Git commit (client): 7c8fca2
OS/Arch (client): linux/amd64
FATA[0000] Get http:///var/run/docker.sock/v1.18/version: dial unix /var/run/docker.sock: permission denied. Are you trying to connect to a TLS-enabled daemon without TLS?

Previously i enter the following command to let the docker to listen to the port 2375
sudo docker -H tcp://0.0.0.0:2375 -d

Now I start the docker with “sudo service docker start” command and it gives the output "docker start/running, process 19408"
Now problem arises when I tried to run an ubuntu image using command “sudo docker --tlsverify=false run ubuntu”. It gives following output:
FATA[0000] Cannot connect to the Docker daemon. Is ‘docker -d’ running on this host?

I have tried searching many articles. But unable to restore docker to listen to the socket instead of tcp port.
Please help me.

-Thank you


(Ralph Kincade) #2

HI can you open the /etc/default/docker file and add this line in

“DOCKER_OPTS=”-H unix:///var/run/docker.sock"

you also what to comment out any other DOCKER_OPTS lines and save it

restart the docker services

post the file here when you are done changing it !!!

good luck


(Reachchinu) #3

Hi,
Thanks for your response.
I tried according to your post.

Before change:
funlab@funlab-Docker-PC:~$ cat /etc/default/docker

Docker Upstart and SysVinit configuration file

Customize location of Docker binary (especially for development testing).

#DOCKER="/usr/local/bin/docker"

Use DOCKER_OPTS to modify the daemon startup options.

#DOCKER_OPTS="–dns 8.8.8.8 --dns 8.8.4.4"

If you need Docker to use an HTTP proxy, it can also be specified here.

#export http_proxy=“http://127.0.0.1:3128/

This is also a handy place to tweak where Docker’s temporary files go.

#export TMPDIR="/mnt/bigdrive/docker-tmp"

After change:

Docker Upstart and SysVinit configuration file

Customize location of Docker binary (especially for development testing).

#DOCKER="/usr/local/bin/docker"

Use DOCKER_OPTS to modify the daemon startup options.

#DOCKER_OPTS="–dns 8.8.8.8 --dns 8.8.4.4"
DOCKER_OPTS="-H unix:///var/run/docker.sock"

If you need Docker to use an HTTP proxy, it can also be specified here.

export http_proxy=“http://127.0.0.1:3128/

This is also a handy place to tweak where Docker’s temporary files go.

#export TMPDIR="/mnt/bigdrive/docker-tmp"

After saving above file, I restart docker.
cmd: sudo service docker restart
output:
stop: Unknown instance:
docker start/running, process 21285

After this I tested running following command:
cmd: sudo docker --tlsverify=false run ubuntu
Output:
FATA[0000] Cannot connect to the Docker daemon. Is ‘docker -d’ running on this host?

Problem still exist.
May be I am missing something.

-Thank you


(Sabin Basyal) #4

Can you first try sudo service docker status then removing the --tlsverify=false, just try: sudo docker run ubuntu and share the result?


(Reachchinu) #5

Hi Sabin,
Thank you for your response. In my first post, I have mentioned that when I checked for the status it is showing stopped, but at the same time when I checked for docker version it is giving the result. Still again I tried the same and below is the result.

funlab@funlab-Docker-PC:~$ sudo service docker status
docker stop/waiting

funlab@funlab-Docker-PC:~$ sudo docker run ubuntu
FATA[0000] Cannot connect to the Docker daemon. Is ‘docker -d’ running on this host?

Without using ‘sudo’ I got the following result.

funlab@funlab-Docker-PC:~$ docker run ubuntu
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?

-Thank you


(Ralph Kincade) #6

it looks like the service is stopped

try “sudo service docker start” or restart the server


(Anvika1) #7

Hi i am unable to restart the services after adding that line. it says docker: service unrecognised. :frowning: Please help me.


(Ralph Kincade) #8

can you verify what is the exact OS you are using ?


(Anvika1) #9

yes I am using windows.


(Anvika1) #10

I am trying to use the docker-py APi and i have set the Docker_opts for tcp. after that i need to restart the sevices for the changes to show, but i am unable to do so.


(Vijaychandran) #11

How can i find DOCKER_OPTS in docker toolbox windows ?