Through docker run command we can link two container by giving name. Is there any configuration
(In json) for doing so in marathon??
ex: docker run -d --link 'name-of-container-to-lnked':'name' 'image'
PS: other than mesos-dns.
Hi @madhusudand .
Yes this should be possible.
You can specify arbitrary Docker parameters as described at the bottom of this page:
https://mesosphere.github.io/marathon/docs/native-docker.html
thanks @aldipower for the response.
In my case configuration would be like
"parameters": [ { "key": "link", "value": "CONTiANER NAME" } ]
But how can i get container name.The name gets assigned automatically by mesos. Is there any way that i can override it.
It would be better if you explain specifically with linking scenario.
If I understood correctly you want to link against a container on a running slave?
From the mesos docs:
The Docker Containerizer launches all containers with the “mesos-” prefix plus the slave id (ie: mesos-slave1-abcdefghji), and also assumes all containers with the “mesos-” prefix is managed by the slave and is free to stop or kill the containers.
So the containername would be mesos-slavename-container-name.
But I am not sure if it makes sense to link against single slaves in terms of reliability.
Could you explain your linking scenario a little bit more in detail? What do you want to achieve?
Thank you.
i'm on the new side myself, but i think this kind of linking would require that the containers being linked reside on the same node.
i have had some success "linking" containers via a call out to the mesos-dns api in the entry point of the container wanting to do the "discovery". for instance, a web-app and it's database. the entrypoint script of the web-app could locate the database via mesos-dns and set some environment variables to connect the web-app to the database. granted this is not ideal, but it works.
there is also https://github.com/mesosphere/marathon/issues/2232 which touches on similar.
i'm visualizing something along the lines of docker-compose which can be applied to a marathon group.
news on this? i need to link more container for deploy the developer branches, i have a web, mysql and elasticsearch container to link together.
Tried with Marathon provided container name, but it did not work:
{
"id": "/gitlab/gitlab",
"container": {
"type": "DOCKER",
"docker": {
"image": "sameersbn/gitlab:8.5.4-1",
"network": "BRIDGE",
"portMappings": [{
"containerPort": 10080,
"hostPort": 10080,
"protocol": "tcp"
},{
"containerPort": 10022,
"hostPort": 10022,
"protocol": "tcp"
}],
"parameters": [{
"key": "env",
"value": "GITLAB_PORT=10080"
}, {
"key": "env",
"value": "GITLAB_SSH_PORT=10022"
}, {
"key": "link",
"value": "mesos-567979e6-1c9d-4147-8679-d2978f9333b1-S6.9eaa61df-5d59-4180-9f5a-4d8923dc3e76:postgresql"
}, {
"key": "link",
"value": "mesos-567979e6-1c9d-4147-8679-d2978f9333b1-S6.583e892e-01c8-4898-b03f-08a4bf7426d0:redisio"
}, {
"key": "publish",
"value": "10080:80"
}, {
"key": "publish",
"value": "10022:22"
}, {
"key": "env",
"value": "GITLAB_SECRETS_DB_KEY_BASE=86eafb1e193bab14fa05d9da"
}, {
"key": "volume-driver",
"value": "rexray"
}, {
"key": "volume",
"value": "gitdata:/home/git/data"
}]
}
},
"instances": 1,
"constraints": [
["hostname", "CLUSTER", "node264.localnet"]
],
"cpus": 0.25,
"mem": 256
}
I get streaming errors from a slave:
Mar 8 15:51:59 node264 docker: time="2016-03-08T15:51:59.797737471-05:00" level=error msg="Handler for GET /v1.22/containers/mesos-567979e6-1c9d-4147-8679-d2978f9333b1-S6.b6b74cbd-2e06-4fca-9ab6-78dbab617aca/json returned error: No such container: mesos-567979e6-1c9d-4147-8679-d2978f9333b1-S6.b6b74cbd-2e06-4fca-9ab6-78dbab617aca"
Mar 8 15:51:59 node264 docker: time="2016-03-08T15:51:59.804550849-05:00" level=error msg="Handler for GET /v1.22/images/mesos-567979e6-1c9d-4147-8679-d2978f9333b1-S6.b6b74cbd-2e06-4fca-9ab6-78dbab617aca/json returned error: No such image: mesos-567979e6-1c9d-4147-8679-d2978f9333b1-S6.b6b74cbd-2e06-4fca-9ab6-78dbab617aca"
Mar 8 15:51:59 node264 mesos-slave[1499]: W0308 15:51:59.816366 1739 slave.cpp:4629] Failed to get resource statistics for executor 'gitlab_gitlab.8248ae46-e56f-11e5-9c76-02429ce31955' of framework 7901cb4e-1e48-4a06-a85b-f340322ad02b-0000: Failed to 'docker -H unix:///var/run/docker.sock inspect mesos-567979e6-1c9d-4147-8679-d2978f9333b1-S6.b6b74cbd-2e06-4fca-9ab6-78dbab617aca': exit status = exited with status 1 stderr = Error: No such image or container: mesos-567979e6-1c9d-4147-8679-d2978f9333b1-S6.b6b74cbd-2e06-4fca-9ab6-78dbab617aca
Mar 8 15:52:02 node264 flanneld: I0308 15:52:02.131899 01595 vxlan.go:340] Ignoring not a miss: ea:c7:d4:a5:45:a8, 192.168.64.0
Mar 8 15:52:14 node264 mesos-slave[1499]: I0308 15:52:14.248411 1739 http.cpp:189] HTTP GET for /slave(1)/state.json from 192.168.19.4:49578 with User-Agent='Go-http-client/1.1'
Mar 8 15:52:14 node264 docker: time="2016-03-08T15:52:14.872720814-05:00" level=error msg="Handler for GET /v1.22/containers/mesos-567979e6-1c9d-4147-8679-d2978f9333b1-S6.b6b74cbd-2e06-4fca-9ab6-78dbab617aca/json returned error: No such container: mesos-567979e6-1c9d-4147-8679-d2978f9333b1-S6.b6b74cbd-2e06-4fca-9ab6-78dbab617aca"
Mar 8 15:52:14 node264 docker: time="2016-03-08T15:52:14.876342476-05:00" level=error msg="Handler for GET /v1.22/images/mesos-567979e6-1c9d-4147-8679-d2978f9333b1-S6.b6b74cbd-2e06-4fca-9ab6-78dbab617aca/json returned error: No such image: mesos-567979e6-1c9d-4147-8679-d2978f9333b1-S6.b6b74cbd-2e06-4fca-9ab6-78dbab617aca"
Mar 8 15:52:14 node264 mesos-slave[1499]: W0308 15:52:14.979513 1742 slave.cpp:4629] Failed to get resource statistics for executor 'gitlab_gitlab.8248ae46-e56f-11e5-9c76-02429ce31955' of framework 7901cb4e-1e48-4a06-a85b-f340322ad02b-0000: Failed to 'docker -H unix:///var/run/docker.sock inspect mesos-567979e6-1c9d-4147-8679-d2978f9333b1-S6.b6b74cbd-2e06-4fca-9ab6-78dbab617aca': exit status = exited with status 1 stderr = Error: No such image or container: mesos-567979e6-1c9d-4147-8679-d2978f9333b1-S6.b6b74cbd-2e06-4fca-9ab6-78dbab617aca
Mar 8 15:52:19 node264 mesos-slave[1499]: I0308 15:52:19.624517 1742 slave.cpp:3987] Terminating executor ''gitlab_gitlab.8248ae46-e56f-11e5-9c76-02429ce31955' of framework 7901cb4e-1e48-4a06-a85b-f340322ad02b-0000' because it did not register within 1mins
Mar 8 15:52:19 node264 mesos-slave[1499]: I0308 15:52:19.627485 1742 docker.cpp:1385] Destroying container 'b6b74cbd-2e06-4fca-9ab6-78dbab617aca'
Mar 8 15:52:19 node264 mesos-slave[1499]: I0308 15:52:19.627944 1742 docker.cpp:1425] Destroying Container 'b6b74cbd-2e06-4fca-9ab6-78dbab617aca' in PULLING state
Mar 8 15:52:19 node264 mesos-slave[1499]: E0308 15:52:19.756479 1740 slave.cpp:3440] Container 'b6b74cbd-2e06-4fca-9ab6-78dbab617aca' for executor 'gitlab_gitlab.8248ae46-e56f-11e5-9c76-02429ce31955' of framework 7901cb4e-1e48-4a06-a85b-f340322ad02b-0000 failed to start: future discarded
Any news on this?
+1 for adding link with dynamic name
+1
+1, and others including "name" and "net".
+1
+1
+1
+1
+1
Here's what I can say: normal apps will likely never get linking support without using something like mesos-dns or dcos and/or things like IP per container etc- remember, they are not guaranteed to be on the same host- so some kind of service discovery mechanism should be used instead.
However, we've been working on a pod feature that has all of the services in a shared CNI namespace on a single host. Perhaps that will meet some of the needs?
Most helpful comment
Here's what I can say: normal apps will likely never get linking support without using something like mesos-dns or dcos and/or things like IP per container etc- remember, they are not guaranteed to be on the same host- so some kind of service discovery mechanism should be used instead.
However, we've been working on a pod feature that has all of the services in a shared CNI namespace on a single host. Perhaps that will meet some of the needs?