Giter Site home page Giter Site logo

Comments (54)

rusllonrails avatar rusllonrails commented on May 18, 2024 15

@gregory
Found the solution.

1) Change the DOCKER_OPTS in /etc/default/docker to:
DOCKER_OPTS="-H tcp://127.0.0.1:4243 -H unix:///var/run/docker.sock"

2) Restart docker
sudo restart docker

3) Make sure that docker is running on localhost:4243 
$ netstat -ant  |grep 4243
tcp        0      0 127.0.0.1:4243          0.0.0.0:*               LISTEN

4) Set DOCKER_HOST (.bashrc)
export DOCKER_HOST=tcp://localhost:4243

$ echo $DOCKER_HOST
tcp://localhost:4243 

5) And now
$ fig run web rails new . --force --database=postgresql --skip-bundle

NOTE, I have:

Ubuntu 14.04
Docker version 1.1.2, build d84a070
Fig 0.5.2

Thanks to http://serverascode.com/2014/05/25/docker-shipyard-multihost.html

from compose.

evilfrog avatar evilfrog commented on May 18, 2024 8
sudo chmod 666 /var/run/docker.sock

should help (Ubuntu 14.04)

from compose.

Mahmoudz avatar Mahmoudz commented on May 18, 2024 2

I had the same error, after 15 min of debugging. Turns out all it needs is a sudo :)
Check out [Create a Docker group] here https://docs.docker.com/engine/installation/linux/ubuntulinux/ to get rid of the sudo prefix.

from compose.

jhohlfeld avatar jhohlfeld commented on May 18, 2024 1

Hey folks, I just found that doing fig up without sudo resulted in this message whereas sudo fig up did the job. Just wanted to mention to eventually save some of you some head-scratching..

from compose.

mucsi96 avatar mucsi96 commented on May 18, 2024 1

This helped me:
If you would like to use Docker as a non-root user, you should now consider
adding your user to the "docker" group with something like:

sudo usermod -aG docker your-user

Remember that you will have to log out and back in for this to take effect!

from compose.

aanand avatar aanand commented on May 18, 2024

Yeah, we need to fall back to localhost and 4243 as appropriate when the host and/or port isn't specified. For now, setting DOCKER_HOST=tcp://localhost:4243 should fix it.

from compose.

stefanw avatar stefanw commented on May 18, 2024

Great, this works, thanks!

from compose.

bfirsh avatar bfirsh commented on May 18, 2024

Bug in docker-py: docker/docker-py#166

from compose.

gregory avatar gregory commented on May 18, 2024
$ docker version
Client version: 1.1.1
Client API version: 1.13
Go version (client): go1.2.1
Git commit (client): bd609d2
Server version: 1.1.1
Server API version: 1.13
Go version (server): go1.2.1
Git commit (server): bd609d2

$ ~/bin/boot2docker status
running
$ echo $DOCKER_HOST
tcp://192.168.59.103:2375
$ fig --version
fig 0.5.1
$ fig up
Couldn't connect to Docker daemon at http+unix://var/run/docker.sock - is it running?
If it's at a non-standard location, specify the URL with the DOCKER_HOST environment variable.

Anyone experiencing the same issue?

from compose.

rusllonrails avatar rusllonrails commented on May 18, 2024

@gregory yeah, I got same on:

Ubuntu 14.04
Docker version 1.1.2, build d84a070
Fig 0.5.2

Still not found the way to fix it.
Added detailed explanation here #73

from compose.

gu-fan avatar gu-fan commented on May 18, 2024

Thanks, Got the same issue, and fixed by this thread

from compose.

bfirsh avatar bfirsh commented on May 18, 2024

Think it's fixed now. docker/docker-py#259

from compose.

jaydattdesai avatar jaydattdesai commented on May 18, 2024

@RuslanHamidullin - Thanks for the solution, it works for me even on ubuntu 12.04

from compose.

rusllonrails avatar rusllonrails commented on May 18, 2024

@jaydattdesai 🍻

from compose.

trkrameshkumar avatar trkrameshkumar commented on May 18, 2024

@RuslanHamidullin your solution works for me as well, Thank you.

I have

Ubuntu 14.04
Docker 1.3.2
fig 1.0.1

from compose.

rusllonrails avatar rusllonrails commented on May 18, 2024

@trkrameshkumar 🍻

from compose.

trkrameshkumar avatar trkrameshkumar commented on May 18, 2024

@RuslanHamidullin but every time i log out or restart my laptop, i have to follow these steps again

2) Restart docker
sudo restart docker

3) Make sure that docker is running on localhost:4243 
$ netstat -ant  |grep 4243
tcp        0      0 127.0.0.1:4243          0.0.0.0:*               LISTEN

4) Set DOCKER_HOST (.bashrc)
export DOCKER_HOST=tcp://localhost:4243

$ echo $DOCKER_HOST
tcp://localhost:4243 

how can we make this configuration permanent.

from compose.

trkrameshkumar avatar trkrameshkumar commented on May 18, 2024

i added this line

export DOCKER_HOST=tcp://localhost:4243
on .bashrc file now it is loaded very time

from compose.

rusllonrails avatar rusllonrails commented on May 18, 2024

@trkrameshkumar nice catch 👍

from compose.

Ecno92 avatar Ecno92 commented on May 18, 2024

Executing fig commands with sudo seems fix these kinds of issues. In the docker.io blog I also see that people are executing fig as root (http://blog.docker.com/2014/08/orchestrating-docker-containers-in-production-using-fig/).

Are root permissions required or is there any way to use docker/fig at the user level?

from compose.

ddliu avatar ddliu commented on May 18, 2024

@evilfrog works for me!

But you have to execute it every time you restart docker.

from compose.

thaJeztah avatar thaJeztah commented on May 18, 2024

@ddliu @evilfrog that's a serious security issue; Anyone that is able to access docker.sock has effectively root access to your machine.

from compose.

ddliu avatar ddliu commented on May 18, 2024

@thaJeztah I understand the risk, it's OK for me as a quick fix for my development environment.

from compose.

thaJeztah avatar thaJeztah commented on May 18, 2024

@ddliu Alright, just mentioning because posting such things on the internet will result in people doing this blindly.

Having said that, a better approach is described in the documentation;
https://docs.docker.com/installation/ubuntulinux/#giving-non-root-access

Of course, the same applies here; anyone that's able to connect to docker.sock is able to get root access on your machine.

from compose.

ddliu avatar ddliu commented on May 18, 2024

@thaJeztah Agree, risks should be declared.

from compose.

bitliner avatar bitliner commented on May 18, 2024

Docker version is

Docker version 1.0.1, build 990021a

if I run netstat -ant |grep 4243 the result is empty (but docker is running).

Because of this I got same error:

Couldn't connect to Docker daemon at http+unix://var/run/docker.sock - is it running?

If it's at a non-standard location, specify the URL with the DOCKER_HOST environment variable.

Apparently the error is due to the docker daemon that stops as soon as it is started.
Using dmesg, the following messages I found:

[82051.692455] init: docker.io main process ended, respawning
[82051.803605] init: docker.io main process (6945) terminated with status 1
[82051.803615] init: docker.io respawning too fast, stopped

Apparently the issue is due to Linux Mint. Here where they talk about it.

Solved running sudo apt-get install apparmor as described here.

from compose.

hasanmehmood avatar hasanmehmood commented on May 18, 2024

Please help! I am getting the same error again and again whenever i run any docker command!

hassan@hassanmehmood:~$ sudo docker version
Client version: 1.0.1
Client API version: 1.12
Go version (client): go1.2.1
Git commit (client): 990021a
2015/03/03 11:12:49 Cannot connect to the Docker daemon. Is 'docker -d' running on this host?```

from compose.

rept avatar rept commented on May 18, 2024

I tried everything in this thread. Still no luck.

rept@temponia:~/passenger$ netstat -ant  |grep 4243
tcp        0      0 127.0.0.1:4243          0.0.0.0:*               LISTEN     
rept@temponia:~/passenger$ echo $DOCKER_HOST
tcp://localhost:4243
rept@temponia:~/passenger$ sudo docker-compose build
db uses an image, skipping
Building web...
Couldn't connect to Docker daemon at http+unix://var/run/docker.sock - is it running?

If it's at a non-standard location, specify the URL with the DOCKER_HOST environment variable.

This is the version:

rept@temponia:~/passenger$ sudo docker version
Client version: 1.0.1
Client API version: 1.12
Go version (client): go1.2.1
Git commit (client): 990021a
Server version: 1.0.1
Server API version: 1.12
Go version (server): go1.2.1
Git commit (server): 990021a

Any ideas?

from compose.

crsmithdev avatar crsmithdev commented on May 18, 2024

Same issue.

vagrant@local:~/template$ docker-compose build
Building web...
Couldn't connect to Docker daemon at http+unix://var/run/docker.sock - is it running?

If it's at a non-standard location, specify the URL with the DOCKER_HOST environment variable.
vagrant@local:~/template$ DOCKER_HOST="unix://var/run/docker.sock" docker-compose build
Building web...
Couldn't connect to Docker daemon at http+unix://var/run/docker.sock - is it running?

If it's at a non-standard location, specify the URL with the DOCKER_HOST environment variable.
vagrant@local:~/template$ sudo docker version
Client version: 1.5.0
Client API version: 1.17
Go version (client): go1.4.1
Git commit (client): a8a31ef
OS/Arch (client): linux/amd64
Server version: 1.5.0
Server API version: 1.17
Go version (server): go1.4.1
Git commit (server): a8a31ef

from compose.

jice-lavocat avatar jice-lavocat commented on May 18, 2024

Got the problem, and the small fix by @evilfrog solved it on Ubuntu 14.04. Thanks.

from compose.

ianpackard avatar ianpackard commented on May 18, 2024

I had this problem too after a system crash in Ubuntu 14.04. It turned out my network was not enabled.

from compose.

Glideh avatar Glideh commented on May 18, 2024

I have this issue with docker-compose

$ lsb_release -ds
Debian GNU/Linux 8.1 (jessie)

$ docker -v
Docker version 1.6.2, build 7c8fca2

$ docker-compose -v
docker-compose version: 1.4.0

$ echo $DOCKER_HOST
tcp://localhost:4243

$ netstat -ant | grep 4243
[nothing]

$ sudo service docker status
[...]active (running)[...]

$ docker-compose build
Couldn't connect to Docker daemon at http://localhost:4243 - is it running?

If it's at a non-standard location, specify the URL with the DOCKER_HOST environment
variable.

from compose.

thaJeztah avatar thaJeztah commented on May 18, 2024

docker 1.6.2 is quite old now; also, the standard ports for docker are now 2375 (non-TLS) and 2376 (TLS). Are you sure the daemon is configured to listen on localhost, and on port 4243?

What does docker info and docker version (not -v) output?

from compose.

Glideh avatar Glideh commented on May 18, 2024

I just installed Docker & docker-compose (following the official instructions for Debian 8) along with a brand new Debian installation.

$ docker info
FATA[0000] Cannot connect to the Docker daemon. Is 'docker -d' running on this host? 
$ docker version
Client version: 1.6.2
Client API version: 1.18
Go version (client): go1.3.3
Git commit (client): 7c8fca2
OS/Arch (client): linux/amd64
FATA[0000] Cannot connect to the Docker daemon. Is 'docker -d' running on this host? 

Maybe I should install the curl version ?

from compose.

dnephin avatar dnephin commented on May 18, 2024

Like the error message says, is the daemon running? (ps aux | grep docker)

from compose.

Glideh avatar Glideh commented on May 18, 2024

I don't see it in the processes

$ ps aux | grep docker
me       3644  0.0  0.0  12720  2164 pts/0    S+   16:58   0:00 grep docker

But the service claims to be running

$ sudo service docker status
[...]active (running)[...]

If I run it manually (as root, I'm in the docker group but I'm still getting permission denied), I see no error and it's not exited

$ sudo docker -d
INFO[0000] +job init_networkdriver()                    
INFO[0000] +job serveapi(unix:///var/run/docker.sock)   
INFO[0000] Listening for HTTP on unix (/var/run/docker.sock) 
INFO[0000] -job init_networkdriver() = OK (0)           
WARN[0000] mountpoint for memory not found              
INFO[0000] Loading containers: start.                   

INFO[0000] Loading containers: done.                    
INFO[0000] docker daemon: 1.6.2 7c8fca2; execdriver: native-0.2; graphdriver: aufs 
INFO[0000] +job acceptconnections()                     
INFO[0000] -job acceptconnections() = OK (0)            
INFO[0000] Daemon has completed initialization          

But docker-compose still tells it can't connect to the daemon

from compose.

thaJeztah avatar thaJeztah commented on May 18, 2024

just installed Docker & docker-compose (following the official instructions for Debian 8) along with a brand new Debian installation.

Hm, good point; looking at those, the installation docs are not really consistent; for the Debian docs, we're explaining how to install the packages maintained by Debian, whereas for the Ubuntu, RHEL, CentOS and Fedora docs, we explain how to install the packages maintained by Docker. I'll open an issue in the Docker issue tracker, because I think we should be consistent (or at least explain both options)

Back to the issue at hand here; so, it looks like the daemon (as installed from the Debian packages), fails to start properly. Installing the Docker maintained version could work; the easiest way to do this is;

curl -sSL https://get.docker.com/ | sh

(be sure to uninstall the docker.io package first).

Before doing that, it would be interesting to check why it fails to start; could you:

I'll "ping" the maintainers of the Debian docker.io package, perhaps they have some thoughts;

ping @tianon @paultag I think you may be interested in this one, or are able to assist here

from compose.

tianon avatar tianon commented on May 18, 2024

That http://localhost:4243 looks fishy -- why wouldn't you be using the unix socket?

from compose.

Glideh avatar Glideh commented on May 18, 2024

Thank you very much @thaJeztah, I'll be able to check all these things tomorrow:

  • Checking the Docker log
  • Checking the config with the script
  • Uninstall docker.io
  • Install docker with the curl script

I agree about the installation instructions, maybe there should be only 1 suggested installation, I saw the curl install but I though the Debian one was more appropriate

from compose.

Glideh avatar Glideh commented on May 18, 2024

I found some logs in /var/log/daemon.log (no other log file found):

level=info msg="+job init_networkdriver()"
level=info msg="+job serveapi(fd://)"
level=info msg="Listening for HTTP on fd ()"
level=info msg="-job init_networkdriver() = OK (0)"
level=warning msg="mountpoint for memory not found"
level=info msg="Loading containers: start."
level=info msg="Loading containers: done."
level=info msg="docker daemon: 1.6.2 7c8fca2; execdriver: native-0.2; graphdriver: aufs"
level=info msg="+job acceptconnections()"
level=info msg="-job acceptconnections() = OK (0)"
level=info msg="Daemon has completed initialization"

Actually exactly the same I'm getting with docker -d (which seems logical) so the service seems successfully loaded, maybe it's using the socket instead (like @tianon was saying)

$ ./check-config.sh # (from docker github)

warning: /proc/config.gz does not exist, searching other paths for kernel config ...
info: reading kernel config from /boot/config-3.16.0-4-amd64 ...

Generally Necessary:

  • cgroup hierarchy: properly mounted [/sys/fs/cgroup]
  • CONFIG_NAMESPACES: enabled
  • CONFIG_NET_NS: enabled
  • CONFIG_PID_NS: enabled
  • CONFIG_IPC_NS: enabled
  • CONFIG_UTS_NS: enabled
  • CONFIG_DEVPTS_MULTIPLE_INSTANCES: enabled
  • CONFIG_CGROUPS: enabled
  • CONFIG_CGROUP_CPUACCT: enabled
  • CONFIG_CGROUP_DEVICE: enabled
  • CONFIG_CGROUP_FREEZER: enabled
  • CONFIG_CGROUP_SCHED: enabled
  • CONFIG_CPUSETS: enabled
  • CONFIG_MEMCG: enabled
  • CONFIG_MACVLAN: enabled (as module)
  • CONFIG_VETH: enabled (as module)
  • CONFIG_BRIDGE: enabled (as module)
  • CONFIG_BRIDGE_NETFILTER: enabled
  • CONFIG_NF_NAT_IPV4: enabled (as module)
  • CONFIG_IP_NF_FILTER: enabled (as module)
  • CONFIG_IP_NF_TARGET_MASQUERADE: enabled (as module)
  • CONFIG_NETFILTER_XT_MATCH_ADDRTYPE: enabled (as module)
  • CONFIG_NETFILTER_XT_MATCH_CONNTRACK: enabled (as module)
  • CONFIG_NF_NAT: enabled (as module)
  • CONFIG_NF_NAT_NEEDED: enabled
  • CONFIG_POSIX_MQUEUE: enabled

Optional Features:

  • CONFIG_MEMCG_KMEM: missing
  • CONFIG_MEMCG_SWAP: enabled
  • CONFIG_MEMCG_SWAP_ENABLED: missing
    (note that cgroup swap accounting is not enabled in your kernel config, you can enable it by setting boot option "swapaccount=1")
  • CONFIG_RESOURCE_COUNTERS: enabled
  • CONFIG_BLK_CGROUP: enabled
  • CONFIG_IOSCHED_CFQ: enabled
  • CONFIG_BLK_DEV_THROTTLING: enabled
  • CONFIG_CGROUP_PERF: enabled
  • CONFIG_CGROUP_HUGETLB: missing
  • CONFIG_NET_CLS_CGROUP: enabled (as module)
  • CONFIG_CGROUP_NET_PRIO: enabled
  • CONFIG_CFS_BANDWIDTH: missing
  • CONFIG_FAIR_GROUP_SCHED: enabled
  • CONFIG_RT_GROUP_SCHED: missing
  • CONFIG_EXT3_FS: missing
  • CONFIG_EXT3_FS_XATTR: missing
  • CONFIG_EXT3_FS_POSIX_ACL: missing
  • CONFIG_EXT3_FS_SECURITY: missing
    (enable these ext3 configs if you are using ext3 as backing filesystem)
  • CONFIG_EXT4_FS: enabled (as module)
  • CONFIG_EXT4_FS_POSIX_ACL: enabled
  • CONFIG_EXT4_FS_SECURITY: enabled
  • Storage Drivers:
    • "aufs":
      • CONFIG_AUFS_FS: enabled (as module)
    • "btrfs":
      • CONFIG_BTRFS_FS: enabled (as module)
    • "devicemapper":
      • CONFIG_BLK_DEV_DM: enabled (as module)
      • CONFIG_DM_THIN_PROVISIONING: enabled (as module)
    • "overlay":
      • CONFIG_OVERLAY_FS: missing
    • "zfs":
      • /dev/zfs: missing
      • zfs command: missing
      • zpool command: missing

from compose.

Glideh avatar Glideh commented on May 18, 2024

Still have the issue after uninstalling docker.io and installed with the curl way (now 1.8.1):

$ echo $DOCKER_HOST
tcp://localhost:4243
$ docker-compose ps
Couldn't connect to Docker daemon at http://localhost:4243 - is it running?

If it's at a non-standard location,
specify the URL with the DOCKER_HOST environment variable.

from compose.

Glideh avatar Glideh commented on May 18, 2024

Fixed !
Systemd docker installation seems to use the systemd socket (fd://) by default.
Trying to use it, docker-compose tells me the fd protocol is not implemented.
So I added the /var/run/docker.sock to the systemd docker conf and I've been able to connect.

from compose.

thaJeztah avatar thaJeztah commented on May 18, 2024

Good to hear! Just a tip; when customizing systemd options, the best approach is to not modify the default docker.service, but to use "drop-ins"; this section explains how to do that; https://docs.docker.com/articles/systemd/#custom-docker-daemon-options

I still wonder where the DOCKER_HOST localhost:4234 came from (since you mentioned this was on a fresh install).

@dnephin is there anything to be done in docker-compose w.r.t not supporting fd://?

from compose.

Glideh avatar Glideh commented on May 18, 2024

Thank you for the systemd option tip.
To be clear about localhost:4234, I did set this environment variable because the default http+unix://var/run/docker.sock assumed by docker-compose were not connecting (and I though the daemon were defaulting to localhost:4234).

from compose.

thaJeztah avatar thaJeztah commented on May 18, 2024

@Glideh ah, thanks for explaining, yes 4234 was the "old" port, we now have 2375/2376 registered at iana.

from compose.

Glideh avatar Glideh commented on May 18, 2024

I see, keeping in mind the default was actually fd://

from compose.

thaJeztah avatar thaJeztah commented on May 18, 2024

@Glideh yes, perhaps a separate issue should be created for that?

from compose.

Glideh avatar Glideh commented on May 18, 2024

That's right, let me create one

from compose.

elouanKeryell-Even avatar elouanKeryell-Even commented on May 18, 2024

I had the following error:

$ docker-compose up
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.

Following mucsi96's piece of advice (#88 (comment)), I added myself to the docker group and now docker-compose works fine.

from compose.

ismailsunni avatar ismailsunni commented on May 18, 2024

@WinstonSureChill glad, had the same problem and the same solution as yours. Thanks

from compose.

lrkwz avatar lrkwz commented on May 18, 2024

@WinstonSureChill same problem but adding myself to docker group did not solve :-(

~/l/l/docker-symfony> groups                                                                                                                                  
    lrkwz adm cdrom sudo dip plugdev lpadmin sambashare wireshark docker

from compose.

Jwpe avatar Jwpe commented on May 18, 2024

@lrkwz I had the same issue - turned out it was due to a corrupted container as described in moby/moby#17688

from compose.

brunodles avatar brunodles commented on May 18, 2024

The problem is on Your docker instalation. I got the same isue here for awhile.
Just add your user to docker group, and try to run docker version, you shuld get something like this:

Client:
 Version:      1.9.1
 API version:  1.21
 Go version:   go1.4.2
 Git commit:   a34a1d5
 Built:        Fri Nov 20 13:20:08 UTC 2015
 OS/Arch:      linux/amd64

Server:
 Version:      1.9.1
 API version:  1.21
 Go version:   go1.4.2
 Git commit:   a34a1d5
 Built:        Fri Nov 20 13:20:08 UTC 2015
 OS/Arch:      linux/amd64

But if you got some instalation issue you won't be able to see server info.
You can always run with root user sudo docker-compose up.
I hope that helps.

from compose.

aleogr avatar aleogr commented on May 18, 2024

@rusllonrails thank you mate

from compose.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.