ERROR: Couldn't connect to Docker daemon at http+docker://localunixsocket - is it running?
I know that there is another issue of the same type but the other issue is closed and I tried all the solutions proposed but with no effect.
still not working:
matteo@ubuntuDockerMB:~/wordpress-docker$ sudo docker -v
Docker version 1.12.3, build 6b644ec
matteo@ubuntuDockerMB:~/wordpress-docker$ sudo docker-compose up
ERROR: Couldn't connect to Docker daemon at http+docker://localunixsocket - is it running?
If it's at a non-standard location, specify the URL with the DOCKER_HOST environment variable.
matteo@ubuntuDockerMB:~/wordpress-docker$ sudo service docker start
start: Job is already running: docker
matteo@ubuntuDockerMB:~/wordpress-docker$ echo $DOCKER_HOST
matteo@ubuntuDockerMB:~/wordpress-docker$ DOCKER_HOST=127.0.0.1
matteo@ubuntuDockerMB:~/wordpress-docker$ echo $DOCKER_HOST
127.0.0.1
matteo@ubuntuDockerMB:~/wordpress-docker$ sudo docker-compose up
ERROR: Couldn't connect to Docker daemon at http+docker://localunixsocket - is it running?
If it's at a non-standard location, specify the URL with the DOCKER_HOST environment variable.
matteo@ubuntuDockerMB:~/wordpress-docker$ unset DOCKER_HOST
matteo@ubuntuDockerMB:~/wordpress-docker$ sudo docker-compose up
ERROR: Couldn't connect to Docker daemon at http+docker://localunixsocket - is it running?
If it's at a non-standard location, specify the URL with the DOCKER_HOST environment variable.
matteo@ubuntuDockerMB:~/wordpress-docker$ groups matteo
matteo : matteo adm cdrom sudo dip plugdev sambashare lpadmin docker
-
I'm part of the docker group
-
I'm using also sudo
-
The process is up
-
The DOCKER_HOST variable is unset or 127.0.0.1
-
Reconnected the user
-
Restarted the server
I think that I've tried all the possible configurations am I right?
Specs:
-
OS: Ubuntu 14.04.04 on Virtualbox on Windows 10 Home.
-
Docker version 1.12.3, build 6b644ec
Thank You!
Have you tried without sudo? You shouldn't need it and it could be messing things up in your case. Also, what do you see when you run docker info?
Try running dockerd or sudo dockerd if required first to start daemon. If you start dockerd with sudo you may want to run docker-compose up with sudo also. otherwise it's fine.
@shin- Hello! I've already done it with with sudo and also using root (sudo su).
matteo@ubuntuDockerMB:~/wordpress-docker$ sudo docker-compose up
ERROR: Couldn't connect to Docker daemon at http+docker://localunixsocket - is it running?
If it's at a non-standard location, specify the URL with the DOCKER_HOST environment variable.
here is the operation made as root
root@ubuntuDockerMB:/home/matteo/wordpress-docker# docker-compose up
ERROR: Couldn't connect to Docker daemon at http+docker://localunixsocket - is it running?
If it's at a non-standard location, specify the URL with the DOCKER_HOST environment variable.
root@ubuntuDockerMB:/home/matteo/wordpress-docker#
this is the result of docker info
root@ubuntuDockerMB:/home/matteo/wordpress-docker# docker info
An error occurred trying to connect: Get http://%2Fvar%2Frun%2Fdocker.sock/v1.24/info: read unix @->/var/run/docker.sock: read: connection reset by peer
@harshajayaweeraXHJ
dockerd does not work but sudo service docker start works as expected
matteo@ubuntuDockerMB:~/wordpress-docker$ sudo dockerd
INFO[0000] libcontainerd: new containerd process, pid: 4039
WARN[0000] containerd: low RLIMIT_NOFILE changing to max current=1024 max=4096
INFO[0001] [graphdriver] using prior storage driver "aufs"
FATA[0001] Error starting daemon: layer does not exist
PS:
@shin- & @harshajayaweeraXHJ Sorry for being late
You need to export the variable for it to be available in child processes:
$ export DOCKER_HOST=127.0.0.1
Although this doesn't completely solve your issue...
I ran into this error because I foolishly ignored the ubuntu prerequisites.
thank you @jamethy, I,ve done just right that and i get
matteo@ubuntuDockerMB:~/wordpress-docker-tut$ docker-compose up -d
Traceback (most recent call last):
File "<string>", line 3, in <module>
File "compose/cli/main.py", line 65, in main
File "compose/cli/main.py", line 114, in perform_command
File "compose/cli/command.py", line 36, in project_from_options
File "compose/cli/command.py", line 111, in get_project
File "compose/cli/command.py", line 83, in get_client
File "compose/cli/docker_client.py", line 74, in docker_client
File "site-packages/docker/client.py", line 59, in __init__
File "site-packages/docker/utils/utils.py", line 438, in parse_host
docker.errors.DockerException: Bind address needs a port: 127.0.0.1
docker-compose returned -1
Having the same problem now, also trying to install Wordpress under docker. Tried everything, but still can' t connect. Docker daemon is not running... I'll try it again
for me the problem stays there:
Bind address needs a port: 127.0.0.1
but this number should be created by docker itself
I have the same problem as the original poster, and have tried all the suggested things above.
It seems that sometimes docker "dies" and is not running, and at other times it stays running. I noticed this while trying to run the docker info command and getting an error about docker not running. Using service docker start then allowed me to run the info command. This is what I got:
Containers: 1
Running: 0
Paused: 0
Stopped: 1
Images: 1
Server Version: 1.12.5
Storage Driver: aufs
Root Dir: /var/lib/docker/aufs
Backing Filesystem: extfs
Dirs: 3
Dirperm1 Supported: true
Logging Driver: json-file
Cgroup Driver: cgroupfs
Plugins:
Volume: local
Network: host bridge overlay null
Swarm: inactive
Runtimes: runc
Default Runtime: runc
Security Options: apparmor seccomp
Kernel Version: 4.4.0-45-generic
Operating System: Ubuntu 16.04.1 LTS
OSType: linux
Architecture: x86_64
CPUs: 24
Total Memory: 31.42 GiB
Name: ayn
ID: 7TGC:G5WQ:6IYF:XWMH:XF3N:VXU7:SLZB:IHRN:T4FL:D35I:5JUA:H4S5
Docker Root Dir: /var/lib/docker
Debug Mode (client): false
Debug Mode (server): false
Registry: https://index.docker.io/v1/
WARNING: No swap limit support
Insecure Registries:
127.0.0.0/8
@matteo-bombelli This error is pretty clear, you need to specify a port. Do export DOCKER_HOST=127.0.0.1:2375 instead.
@matteo-bombelli
I had the same issue.
You need to restart docker.
$ service docker restart
I solved it with this.
can anyone consolidate the solution for this problem in steps ?
Hi. I second this last comment, I am having the same issue.
I am having the same issue.
docker ps works.
docker-compose build (with version 2) works!
docker-compose build (with version 3) gives this error :/
@furkanmustafa @shashijais789 @lalitkumarj It'd be better if you created a new issue with all the info. There are many reasons that can cause a failure to connect to the engine, from network to configuration to the engine potentially crashing / being stopped. Please also make sure to include the engine logs with the debug -D flag.
same problem. works with version 2, I get this error with verison 3 config.
the following steps solved the problem for me.
remove docker:
$ sudo apt-get remove docker docker-engine
reinstall with
curl -sSL https://get.docker.com/ | sh
add user to a group:
sudo usermod -aG docker user
Maybe this error can be displayed if one of the images fails to build for whatever reason, not necessarily having to do with the docker daemon. For example, I have managed to debug this by trying to build each service using Docker.
My docker-compose.yml file contains:
version: '2'
services:
# Drupal server
drupal:
build:
context: .
dockerfile: "Dockerfile-drupal"
mysql:
...
Calling docker-compose build results in:
Couldn't connect to Docker daemon at http+docker://localunixsocket - is it running?
So I tried to use Docker to build each file individually:
docker build -f="Dockerfile-drupal" .
This gave me a more useful error:
Error checking context: 'no permission to read from some/data/directory'
Fixing that error and making sure I can build Dockerfile-drupal resulted in docker-compose build working fine.
Perhaps the code which outputs the error might be changed to something like:
Couldn't build the services.
* Make sure you can build your Docker images using "docker build ...".
* Make sure the Docker daemon is running.
* If the Docker daemon is at a non-standard location, specify the URL with the DOCKER_HOST environment variable. Currently using http+docker://localunixsocket.
Needed all of:
- apt-get remove and re-install using curl as Kirill-Babkin suggests (and restart socker to be safe)
- add user to docker group using usermod -aG, logout and login
- undefine DOCKER_HOST (as suggested by rkazak at https://forums.docker.com/t/docker-commands-require-sudo/12987/2) which I had earlier set using >export DOCKER_HOST=127.0.0.1:2375 as suggested by jamethy and shin This was on an RPi 3B. After all of this, docker is now working. Is there any chance this could be cleaned up so others don't have to go through this painful experience, as it is experiences like this docker is designed to fix? Just a suggestion.
In my case LAN proxy (that is defined in Internet Options - I am on Windows) had prevented docker-compose from connecting to VM (with docker engine) on VirtualBox Host-Only Network - disabling proxy has solved an issue.
On Ubuntu 16.04 this worked for me:
sudo service docker start && docker-compose up -d