Docker not found by swarm agent

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):

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?

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.

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

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 - 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?

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 ?

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 - 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

Same when trying to start Wordpress from the Catalog:

exit status 1: Couldn’t connect to Docker daemon at 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