Comments (54)
@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.
sudo chmod 666 /var/run/docker.sock
should help (Ubuntu 14.04)
from compose.
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.
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.
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.
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.
Great, this works, thanks!
from compose.
Bug in docker-py: docker/docker-py#166
from compose.
$ 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.
@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.
Thanks, Got the same issue, and fixed by this thread
from compose.
Think it's fixed now. docker/docker-py#259
from compose.
@RuslanHamidullin - Thanks for the solution, it works for me even on ubuntu 12.04
from compose.
from compose.
@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.
from compose.
@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.
i added this line
export DOCKER_HOST=tcp://localhost:4243
on .bashrc
file now it is loaded very time
from compose.
@trkrameshkumar nice catch 👍
from compose.
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.
@evilfrog works for me!
But you have to execute it every time you restart docker.
from compose.
@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.
@thaJeztah I understand the risk, it's OK for me as a quick fix for my development environment.
from compose.
@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.
@thaJeztah Agree, risks should be declared.
from compose.
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.
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.
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.
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.
Got the problem, and the small fix by @evilfrog solved it on Ubuntu 14.04. Thanks.
from compose.
I had this problem too after a system crash in Ubuntu 14.04. It turned out my network was not enabled.
from compose.
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.
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.
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.
Like the error message says, is the daemon running? (ps aux | grep docker
)
from compose.
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.
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:
- Check the docker daemon log-file
- Check if there are requirements missing, by running this script; https://raw.githubusercontent.com/docker/docker/master/contrib/check-config.sh
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.
That http://localhost:4243
looks fishy -- why wouldn't you be using the unix socket?
from compose.
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.
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.
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.
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.
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.
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.
@Glideh ah, thanks for explaining, yes 4234
was the "old" port, we now have 2375/2376 registered at iana.
from compose.
I see, keeping in mind the default was actually fd://
from compose.
@Glideh yes, perhaps a separate issue should be created for that?
from compose.
That's right, let me create one
from compose.
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.
@WinstonSureChill glad, had the same problem and the same solution as yours. Thanks
from compose.
@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.
@lrkwz I had the same issue - turned out it was due to a corrupted container as described in moby/moby#17688
from compose.
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.
@rusllonrails thank you mate
from compose.
Related Issues (20)
- [BUG] option --env-file not working after updating from 2.27.0 to 2.27.1 HOT 1
- [BUG] Overlay network not found on worker node HOT 3
- [BUG] Variable substitution in secrets file path not working
- @derNiklaas: I have stumbled upon a similar issue, but what I discovered was that I had two services setup towards a docker network, with one of the services configured with a static ipv4 assignment, while the other did not have a static IP assigned. HOT 2
- [BUG] docker inline config when changed is not being taken into account
- ### Describe the feature or problem you’d like to solve
- Support language-specific build tools
- `docker compose config` outputs an invalid format for `deploy.resources.limits.cpus`
- ~~Should fix pbek/QOwnNotes#2952~~
- [BUG] docker compose config merges environment variables into a list HOT 3
- [BUG] usage of `--env-file` regressed from v2.27.0 to v2.27.1 HOT 4
- [BUG] docker compose config ignores services with -profile HOT 2
- [BUG] services.web.ports array items[0,1] must be unique HOT 4
- [BUG] `app_protocol`and `mode` settings of long syntax in service ports section have no effect HOT 6
- Trying to pull repository docker.io/clearwater ,failed
- support env variable COMPOSE_TIMEOUT HOT 4
- [BUG] Loading COMPOSE_FILE from .env-file stopped working HOT 1
- ci pipeline failing for .net HOT 14
- wordpress-1 | exec /usr/local/bin/docker-entrypoint.sh: exec format error HOT 2
- [BUG] Merge does not work properly with required variables HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from compose.