gliderlabs / registrator

Service registry bridge for Docker with pluggable adapters
http://gliderlabs.com/registrator
MIT License
4.66k stars 912 forks source link

Fails to create Registrator with Marathon: dial unix /tmp/docker.sock: no such file or directory #459

Open sliter opened 8 years ago

sliter commented 8 years ago

I am trying to run Registrator via Marathon and I have created the two JSON scripts attached at the end.

The problem is Script B runs well while Script A will throw errors:

[root@worker2 ~]# docker logs 7bf7f5dd1f16 2016/08/18 14:26:10 Starting registrator v7 ... 2016/08/18 14:26:10 Using consul adapter: consul://localhost:8500 2016/08/18 14:26:10 Connecting to backend (0/0) 2016/08/18 14:26:10 consul: current leader 192.168.20.10:8300 2016/08/18 14:26:10 Listening for Docker events ... 2016/08/18 14:26:10 Get http://unix.sock/containers/json: dial unix /tmp/docker.sock: no such file or directory

I just wonder what causes the problem?

Script A: `{

"id": "registrator",
"instances": 1,
"container": {
    "type": "DOCKER",
    "docker": {
        "image": "gliderlabs/registrator:latest",
        "network": "HOST"
    },
    "parameters": [
        {
            "key": "volume",
            "value": "/var/run/docker.sock:/tmp/docker.sock"
        }
    ]
},
"args": ["consul://localhost:8500"]

}`

Script B: `{

"id": "registrator",
"instances": 1,
"container": {
    "type": "DOCKER",
    "docker": {
        "image": "gliderlabs/registrator:latest",
        "network": "HOST"
    },
    "volumes": [
        {
            "containerPath": "/tmp/docker.sock",
            "hostPath": "/var/run/docker.sock",
            "mode": "RW"
        }
    ]
},
"args": ["consul://localhost:8500"]

}`

josegonzalez commented 8 years ago

If you enter the container, does the socket exist and is it readable?

sliter commented 8 years ago

@josegonzalez I am not able to enter the container, it was exited right after it got started. Is anyone able to reproduce the problem or it is only with my setup?

josegonzalez commented 8 years ago

Does the hostpath exist? I've not seen this error reported yet.

monokrome commented 6 years ago

Seems like this occurs on Amazon ECS as well.

josegonzalez commented 6 years ago

@monokrome can't say I'll investigate because of price or time commitments, but do you have a cloudformation or similar way to reproduce? My original issue was being unable to quickly standup marathon to test.

josegonzalez commented 6 years ago

Same for @sliter :)