# Docker not found by swarm agent

**URL:** <https://forums.suse.com/t/docker-not-found-by-swarm-agent/3157>\
**Category:** Rancher 1.x\
**Created:** [June 17, 2016, 1:35pm UTC](https://forums.suse.com/t/docker-not-found-by-swarm-agent/3157 "2016-06-17T13:35:15Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![stef](https://avatars.discourse-cdn.com/v4/letter/s/76d3ee/32.png) [@stef](https://forums.suse.com/u/stef)\
**Post date:** [June 17, 2016, 1:35pm UTC](https://forums.suse.com/t/docker-not-found-by-swarm-agent/3157/1 "2016-06-17T13:35:15Z")

</div>

I’ve created a SWARM environment, added a host (same host which is running docker & the rancher-server container), ran the agent start script. All well & good so far. If I now add a project & try to run it, I get an error (logged in r-Swarm\_swarm-agent\_1):

```auto
time="2016-06-17T12:32:46Z" level=info msg="Running docker-compose [-p m up -d] in /tmp/docker-compose693709405" eventId=04ef0855-ce78-438d-a964-f20f0969b9f4
time="2016-06-17T12:32:46Z" level=info msg="output: Couldn't connect to Docker daemon at http://docker:2375 - is it running?" eventId=04ef0855-ce78-438d-a964-f20f0969b9f4
time="2016-06-17T12:32:46Z" level=info msg="output: " eventId=04ef0855-ce78-438d-a964-f20f0969b9f4

```

I have not set `http://docker:2375` anywhere - it seems to be some (incorrect?) default.

Can anyone advise where `DOCKER_HOST` should be set such that `r-Swarm_swarm-agent_1` picks up the change? Or is that not the correct soln?

---

<div class="post-metadata">

**Author:** ![denise](https://avatars.discourse-cdn.com/v4/letter/d/82dd89/32.png) [@denise](https://forums.suse.com/u/denise)\
**Post date:** [June 21, 2016, 9:42pm UTC](https://forums.suse.com/t/docker-not-found-by-swarm-agent/3157/2 "2016-06-21T21:42:04Z")

</div>

Can you share your docker-compose.yml that you added for creating your project?

What version of Rancher are you running? What verison of Docker? And how many hosts?

I was able to add a simple docker-compose.yml into the “Add Project” section with no issues.

---

<div class="post-metadata">

**Author:** ![Dzianis\_Shkindzerau](https://sea2.discourse-cdn.com/flex022/user_avatar/forums.suse.com/dzianis_shkindzerau/32/1475_2.png) [@Dzianis\_Shkindzerau](https://forums.suse.com/u/Dzianis_Shkindzerau)\
**Post date:** [July 11, 2016, 7:51am UTC](https://forums.suse.com/t/docker-not-found-by-swarm-agent/3157/3 "2016-07-11T07:51:50Z")

</div>

The same issue.

I have 3 VMs (1- for rancher server, 2- for agent nodes):  
$ uname  
Linux 3.16.0-4-amd64 #1 SMP Debian 3.16.7-ckt25-1 x86\_64 GNU/Linux  
$ docker -v  
Docker version 1.11.1, build 5604cbe  
$ docker-compose -v  
docker-compose version 1.7.1, build 0a9ab35

I use this commands to start rancher server and agents:  
$ docker run -d   
-v /home/user/rancher/mysql:/var/lib/mysql   
-v /home/user/rancher:/var/log/mysql   
-v /home/user/rancher/cattle:/var/lib/cattle   
–restart=always   
–name=rancher-server   
-p 8080:8080   
rancher/server

docker run -d --privileged   
-v /var/run/docker.sock:/var/run/docker.sock   
-v /var/lib/rancher:/var/lib/rancher   
rancher/agent:v1.0.2 [http://host.domen.com:8080/v1/scripts/vvvvvv](http://host.domen.com:8080/v1/scripts/vvvvvv)…

docker-compose.yml content is:  
grf:  
image: grafana/grafana

When I start docker-compose.yml (Swarm environment -\> Projects -\> Add Project), I get an the same error:  
Error (exit status 1: Couldn’t connect to Docker daemon at [http://docker:2375](http://docker:2375) - is it running? If it’s at a non-standard location, specify the URL with the DOCKER\_HOST environment variable. )

When I start docker-compose.yml (Swarm environment -\> System -\> Add Stack), I get service in running state (Running grf\_grf\_1).

Any ideas? How can I fix the error with connection to the daemon?

---

<div class="post-metadata">

**Author:** ![Fraser\_Goffin](https://sea2.discourse-cdn.com/flex022/user_avatar/forums.suse.com/fraser_goffin/32/6608_2.png) [@Fraser\_Goffin](https://forums.suse.com/u/Fraser_Goffin)\
**Post date:** [July 11, 2016, 7:48pm UTC](https://forums.suse.com/t/docker-not-found-by-swarm-agent/3157/4 "2016-07-11T19:48:44Z")

</div>

Is the docker daemon on your VM instances configured to allow connection to either tcp port 2375 (insecure) or 2376 (tls) as in -H 0.0.0.0:2375 ?

---

<div class="post-metadata">

**Author:** ![stef](https://avatars.discourse-cdn.com/v4/letter/s/76d3ee/32.png) [@stef](https://forums.suse.com/u/stef)\
**Post date:** [August 18, 2016, 2:06pm UTC](https://forums.suse.com/t/docker-not-found-by-swarm-agent/3157/5 "2016-08-18T14:06:29Z")

</div>

Sorry for the late reply! I have since collected some additional info:

rancher server 1.1.0  
rancher agent v1.0.2  
rancher agent instance v0.8.1  
rancher swarm agent 0.1.2  
docker 1.10.2 (latest version I could find built against go 1.5)

Now running with a single host.

I’ve simplified the compose file to a minimum:

> mysql-docker:  
> user: 498:496  
> image: localhost:5000/sles12sp1-mysql:5.7.12  
> volumes:
> 
> - /home/docker\_mysql:/var/lib/mysql

The r-Swarm\_swarm-agent\_1 container has a DOCKER\_HOST env var referring to ‘docker’ defined, which none of the other containers seem to have:

> docker exec -ti r-Swarm\_swarm-agent\_1 env | grep DOCKER  
> DOCKER\_HOST=tcp://docker:2375  
> DOCKER\_NAME=/cattle/docker

Note this does NOT happen when importing the same compose file via Swarm → System → Add Stack. There is runs the container as expected!

Where does the reference to ‘docker’ in DOCKER\_HOST come form? It’s not in my DOCKER\_OPS!

The log output form r-Swarm\_swarm-agent\_1 is:

> time=“2016-08-18T13:57:42Z” level=info msg=“Received event: Name: composeProject.create, Event Id: 7cd35441-e590-4153-b7d7-cb3ce25dda12, Resource Id: 1e23”  
> time=“2016-08-18T13:57:42Z” level=info msg=“&{composeProject.create 7cd35441-e590-4153-b7d7-cb3ce25dda12 reply.2766177559194055484 1e23 environment map[environment:map[data:map[fields:map[templates:map[docker-compose:mysql-docker:\n user: 498:496\n image: localhost:5000/sles12sp1-mysql:5.7.12\n volumes:\n - /home/docker\_mysql:/var/lib/mysql] previousExternalId:]] removeTime: created:1.471528662e+12 accountId:5 removed: description: kind:composeProject externalId: state:activating id:23 uuid:861fdea0-11c2-408f-841d-b3c3d8391e3d healthState:healthy name:test type:environment]]}” eventId=7cd35441-e590-4153-b7d7-cb3ce25dda12  
> time=“2016-08-18T13:57:42Z” level=info msg=“Running docker-compose [-p test up -d] in /tmp/docker-compose368297283” eventId=7cd35441-e590-4153-b7d7-cb3ce25dda12  
> time=“2016-08-18T13:57:42Z” level=info msg=“output: Couldn’t connect to Docker daemon at [http://docker:2375](http://docker:2375) - is it running?” eventId=7cd35441-e590-4153-b7d7-cb3ce25dda12  
> time=“2016-08-18T13:57:42Z” level=info msg="output: " eventId=7cd35441-e590-4153-b7d7-cb3ce25dda12  
> time=“2016-08-18T13:57:42Z” level=info msg=“output: If it’s at a non-standard location, specify the URL with the DOCKER\_HOST environment variable.” eventId=7cd35441-e590-4153-b7d7-cb3ce25dda12

---

<div class="post-metadata">

**Author:** ![stef](https://avatars.discourse-cdn.com/v4/letter/s/76d3ee/32.png) [@stef](https://forums.suse.com/u/stef)\
**Post date:** [August 18, 2016, 2:59pm UTC](https://forums.suse.com/t/docker-not-found-by-swarm-agent/3157/6 "2016-08-18T14:59:55Z")

</div>

Same when trying to start Wordpress from the Catalog:

> exit status 1: Couldn’t connect to Docker daemon at [http://docker:2375](http://docker:2375) - is it running?\n\nIf it’s at a non-standard location, specify the URL with the DOCKER\_HOST environment variable.

On the host (which is NOT called ‘docker’):

> root 27751 27750 1 Aug17 pts/6 00:25:49 docker daemon -H tcp://0.0.0.0:2375 -H unix:///var/run/docker.sock
