Agreed. I am seeing errors reported in the daemon that are not being reported back to the CLI. "Couldn't connect" is clearly erroneous in many cases.
I had that error and it stopped when I ran every command as sudo.
Try it out..
@ajbazz No. Clearly no. just add your user in the docker group, fixed. You shouldn't run that kind of command using sudo.
What I mean here is that many types of errors, syntax errors, connectivity errors, not having the right to connect, etc... are all leading to the same message.
Your issue for example should say "OK, the daemon seem to run but I don't have rights to connect, are you in the docker group?" or something of the kind. See the links I pointed to and you'll start to see the diversity of errors reporting the same message. This is clearly a usability issue.
Hello @aminancelot Thank you for reporting this issue. We are going to evaluate this enhancement but note that any Pull Request improving the error reporting would also be greatly appreciated.
@jcsirot Just FYI, if your image:
declaration contains an invalid tag (e.g. one with both lower and upper-case characters) docker-compose --build
returns this error. Ran into this a few times over the past few weeks debugging Jenkins builds and the default error was confusing/misleading.
E.g. if you build this Compose spec with docker-compose
:
services:
app:
build: .
image: some-repo:myTagWithUppercaseChars
version: 3.5
You'll get this wrong and confusing error message:
$ docker-compose build
Building app
Couldn't connect to Docker daemon at http+docker://localhost - is it running?
If it's at a non-standard location, specify the URL with the DOCKER_HOST environment variable.
By contrast, a traditional docker build
gives a meaningful error message:
$ docker build -t some-repo:myTagWithUppercaseChars .
invalid argument "some-repo:myTagWithUppercaseChars" for "-t, --tag" flag: invalid reference format: repository name must be lowercase
See 'docker build --help'.
There's a bit more discussion of this general problem on Medium. The tl;dr is that docker-compose build
gives meaningless errors in a variety of situations. Once you know that's the case it's not the end of the world, but obviously it would be better to surface the correct error.
Thank you Pierre.
Definitely some good information there.
Much appreciated
Aaron
On Thu, May 2, 2019 at 10:48 PM Pierre Ancelot notifications@github.com
wrote:
@ajbazz https://github.com/ajbazz No. Clearly no. just add your user in
the docker group, fixed. You shouldn't run that kind of command using sudo.What I mean here is that many types of errors, syntax errors, connectivity
errors, not having the right to connect, etc... are all leading to the same
message.Your issue for example should say "OK, the daemon seem to run but I don't
have rights to connect, are you in the docker group?" or something of the
kind. See the links I pointed to and you'll start to see the diversity of
errors reporting the same message. This is clearly a usability issue.—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/docker/compose/issues/6677#issuecomment-488949418,
or mute the thread
https://github.com/notifications/unsubscribe-auth/ABE2J7Q53ZBRGFR3KSUNLRDPTPG4DANCNFSM4HJCMNTQ
.
What I'm seeing in one of my use-cases is that Docker daemon drops connection in the middle of processing of a build command, without providing any error. docker-compose
produces the same message, which is very misleading.
I'd attempt to fix by extending handle_connection_errors
, but not sure that's the right way...
I got the very same error when building an image. I have changed the location of my docker to a different location (via systemd) by using the "-g" parameter
When I delete the whole docker folder and restart docker it will work temporarily.
After a system boot or service restart I'm having this issue again.
docker-compose version 1.24.1, build unknown
docker version 18.09.6-ce, build 481bc77156
Linux 4.19.56-1-MANJARO #1 SMP PREEMPT x86_64 GNU/Linux
This worked for me on Ubuntu 18.04:
sudo usermod -aG docker $USER
sudo chmod 755 -R .
Same as Menda. The problem appeared after an aborted build. One of my images used a directory that was suddenly belonging to 999 instead of me. chmod fixed it.
running the command with sudo fixed the issue
People reporting issue here don't give more details on the condition this error is reported. Running with sudo
is definitely not a good solution, if you read this because you encounter a comparable issue, please double-check current user is in the docker
group and as such can execute docker
CLI and access the engine without permission error.
Closing as not a well described issue we could investigate. If you get such an error please open a new issue and provide a complete description of your environment
@danschmidt5189 I tried to reproduce the more detailed issue you reported and can't reproduce with 1.24.1. I get expected error when running docker-compose build
with an invalid uppercase reposiutory name :
➜ docker-compose build
Building app
ERROR: invalid reference format: repository name must be lowercase
@ndeloof Oh come on! There is no more detail because any error reports the same message and developers couldn't be bothered to do proper error reporting. Please reopen this issue and fix the problem instead of denying it's existence. Seems to me it's getting closed out of laziness. Please reopen it and let someone willing do it.
@aminancelot I can understand your frustration, but you didn't even provided compose/docker version you're using, command being ran, or anything that could help us understand what's going wrong.
I'd be happy to assist you if you still encounter this issue, but then please use the issue template so we gather enough information to offer adequate assistance and diagnostic
Alright, fair enough, I was expecting that the "all routes lead to rome" behaviour could be corrected instead of doing a case by case. At least I know now, if I meet this issue virtually anything can be the error, a syntax error in the compose file can be it.
To anyone coming here finding this issue, if you consider compose, avoid the frustration and wasted time. Look for something else.
No need to be rude.
I took time trying to reproduce the registry uppercase scenario reported by @danschmidt5189 and can't reproduce on 1.24.1, so probably this specific path was fixed already. This high level error is probably hidding many potential lower level errors, there's no silver bullet to just fix them all. So, yes, we need some more detailed report on concrete issues so we can track them down the rabbit hole into root cause, and offer a fix on a case-by-case basis.
I don't think I'm being rude, I'm simply being realistic. It's unfortunate writing doesn't convey tone. Sorry if it seemed so.
I have met this error message for multiple different syntax errors. The link mentioned at the opening of the issue clearly shows different reproducible scenarios in which this is happening.
I'm not rude, I'm just frustrated a good project undermined by something so trivial. I wish I had time to help on it but let's face it, if about anything reports the same error, it's not usable.
The first scenarios reported in the blog post would just be confirmed by trying to run docker info
and confirming user just has no permission to access the docker daemon. Then "_Couldn't connect to Docker daemon_" sounds a reasonable error message, maybe could be rephrased.
The last "different ownership" scenario sounds pretty exotic to me. Could investigate further. Anyway writting a blog post is clearly not the best way to report issues to a project :P
@ndeloof I'm still seeing this in our CI system when testing a build for (essentially) repo/project/testUpperCaseBranchName-docker:latest
. If I forcibly lower-case the branch name (the last part of the registry path), everything's fine, but otherwise I get the same error as before:
> docker --version
Docker version 19.03.5, build 633a0ea
> docker-compose --version
docker-compose version 1.25.0, build b42d419
> docker-compose build --pull
Building ansible-test
Couldn't connect to Docker daemon at http+docker://localhost - is it running?
If it's at a non-standard location, specify the URL with the DOCK ER_HOST environment variable.
script returned exit code 1
It's not a huge deal for us to workaround, but it's weird that I'm still seeing this error and you aren't. (I wonder if the bug was re-introduced in 1.25.0?)
Tried on another computer (OSX):
➜ ~/Downloads/docker-compose-Darwin-x86_64 version
docker-compose version 1.25.0, build 0a186604
docker-py version: 4.1.0
CPython version: 3.7.4
OpenSSL version: OpenSSL 1.1.1c 28 May 2019
➜ ~/Downloads/docker-compose-Darwin-x86_64 build
Building app
ERROR: invalid reference format: repository name must be lowercase
I'll investigate further and add a test case to enforce we handle this scenario
The error message I get is actually sent from docker engine (19.03.5)
https://github.com/docker/distribution/blob/master/reference/normalize.go#L44
This is not a recent change, so it's surprising you don't get the same - maybe some other error is hiding this one, which would have been useful to diagnose this scenario.
@danschmidt5189 which version of docker engine are you running (just run docker version
) ?
https://docs.docker.com/install/linux/linux-postinstall/
sudo groupadd docker
sudo usermod -aG docker $USER
newgrp docker
this helped in my case.
Thanks @pawaroti! That helped!
This worked for me on Ubuntu 18.04:
sudo usermod -aG docker $USER
sudo chmod 755 -R .
- Restart your computer.
It works for my ubuntu 18
https://docs.docker.com/install/linux/linux-postinstall/
sudo groupadd docker sudo usermod -aG docker $USER newgrp docker
Only solution work for my ubuntu 18.4
Only this works for me:
You don't have a docker daemon, check it out:
dockerd
For install him:
sudo apt install docker.io
Guys a magic for this problem!
Really the problem is with permission like @wireshocks said run sudo docker-compose up -d and booom
I never had to use sudo docker-compose before. why do I have to start now? Ubuntu 20.04
I struggled with the problem for a while, turns out the issue was that my services.app.image
contained invalid characters. I fixed the image name and boom! No more such error.
Quick note: If you are specifying your values in the .env file, ensure they don't have quotes. For example instead of DOCKER_APP_IMAGE_NAME="myimage"
use DOCKER_APP_IMAGE_NAME=myimage
I had that error and it stopped when I ran every command as sudo.
Try it out..
Worked on Fedora OS 31. Thanks!
This thread nicely shows that people don't read and search from the bottom for a potential solution to copy/paste.
The original concern was that that message appearing as a catch all exception but then it turned to be a defence for the most common root cause. Grotesque.
Thanks, @wireshocks, worked for me.
I ran into the same problem and this article assisted me to solve the issue.
It's easy to follow and short. Hope it helps others.
https://medium.com/@ibrahimgunduz34/if-you-faced-an-issue-like-couldnt-connect-to-docker-daemon-at-http-docker-localunixsocket-is-27b35f17d09d
Guys a magic for this problem!
- open the terminal and type sudo dockerd and leave it open
- open new terminal and type sudo docker-compose up -d
- booom
bro... you just saved my day
I had that error and it stopped when I ran every command as sudo.
Try it out..
thank you alot
In my case, the issue was as reported @jmleroy . Some directories within my build tree had become owned by root, which I guess was diverting docker daemon somehow while it was indexing the directory structure. I simply chown'd everything back to my user and it works now (no reboot needed):
# MAKE SURE YOU ARE IN YOUR PROJECT DIRECTORY
$ sudo chown -R <username>:<username> *
I ran into the same problem and this article assisted me to solve the issue.
It's easy to follow and short. Hope it helps others.
https://medium.com/@ibrahimgunduz34/if-you-faced-an-issue-like-couldnt-connect-to-docker-daemon-at-http-docker-localunixsocket-is-27b35f17d09d
Yes, you saved my day. It works on CentOS 17
I had that error and it stopped when I ran every command as sudo.
Try it out..
Wow, you are absolutely RIGHT. sudo solves all the problems.
Thank you, mr @ajbazz
I'm staggered by all those comments.
This ticket is NOT AND WAS NEVER ABOUT using sudo or not, if you had read the documentation, you don't need (and shouldn't) use sudo.
This ticket is about about every issue compose meets ends up reported with that same message.
This ticket was then closed by @ndeloof who concluded there was not enough info when enough info was provided.
In other words, this ticket is a mess and a shame. I regret having wasted time reporting it.
Please @ndeloof at least prevent new comments if you won't investigate the issue.
https://docs.docker.com/install/linux/linux-postinstall/
sudo groupadd docker sudo usermod -aG docker $USER newgrp docker
this helped in my case.
worked like a charm for Ubuntu 20.04
thanks!
Most helpful comment
I had that error and it stopped when I ran every command as sudo.
Try it out..