Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Docker params not working #1791

Closed
cmluciano opened this issue Jul 13, 2015 · 8 comments
Closed

Docker params not working #1791

cmluciano opened this issue Jul 13, 2015 · 8 comments

Comments

@cmluciano
Copy link
Contributor

Hi. For some reason I do not think that docker-params are working as expected.

{
  "id": "eureka",
  "container": {
    "docker": {
      "image": "eureka",
      "network": "BRIDGE",
      "parameters": [
        { "key": "hostname", "value": "eureka" }
      ]
    },
    "type": "DOCKER"
  },
  "cpus": 0.03,
  "mem": 64.0,
  "instances": 1,
  "upgradeStrategy": {
    "minimumHealthCapacity": 0.8,
    "maximumOverCapacity": 0.1
  }
}

With the above example, I assumed a docker ps should show a machine with a value of "eureka".
In Dockerland, normally you would pass a "--name eureka", but that does not seem to work either.

@cmluciano
Copy link
Contributor Author

args does not seem to work either

{
  "id": "eureka",
  "container": {
    "docker": {
      "image": "eureka",
      "network": "BRIDGE"
    },
    "type": "DOCKER"
  },
  "args": [
    "--name", "eureka"
  ],
  "cpus": 0.03,
  "mem": 64.0,
  "instances": 1,
  "upgradeStrategy": {
    "minimumHealthCapacity": 0.8,
    "maximumOverCapacity": 0.1
  }
}

@cmluciano
Copy link
Contributor Author

Taking a look at stderr logs , I see this exec: "--name": executable file not found in $PATH

So it looks like these are not being properly appended to docker run

@adam-mesos
Copy link

@cmluciano args is not passed to docker run, but is rather supposed to be the parameters to your Dockerfile ENTRYPOINT. See the "Command vs Args" section of https://mesosphere.github.io/marathon/docs/native-docker.html

On the same page, just below, it describes "Arbitrary Docker Options" using the parameters field (new in 0.7.6), even giving an example using hostname.
Looking around the docker code in Mesos, I notice that there is also a ContainerInfo.hostname field.
https://github.com/apache/mesos/blob/0.23.0-rc3/src/docker/docker.cpp#L422
Even though this field has yet to be incorporated into Marathon as a first class parameter, you should still be able to use --hostname via the parameters field as you first attempted. I'm not sure why this didn't work. Try enabling GLOG_v=1 for your mesos-slave to see exactly what docker run command is being attempted.

@tnachen
Copy link
Contributor

tnachen commented Jul 13, 2015

Hi @cmluciano, mesos manages the name of the container since we integrated before there was support for Labels and we use the name to know which containers are launched/managed by us.

@cmluciano
Copy link
Contributor Author

So these seem to be two conflicts answers. I can indeed use "name" in params but that does not set the name. According to @tnachen it is expected that I should not be able to set the hostname. Is that correct?

@tnachen
Copy link
Contributor

tnachen commented Jul 14, 2015

@cmluciano so I think --name param here is not the hostname of the container, but the name of the container that is displayed when you run docker ps.
Docker run also supports a "hostname" param that you can set, but it only works when you use bridge networking mode as it doesn't make sense to have another hostname with HOST network.

@Kosta-Github
Copy link

Actually, I would like to use the docker --hostname option to set a hostname for the docker container, but would like to add the name of the node the container gets deployed to by env vars substitution at deployment time, e.g.: --hostname=my-service-${MESOS_NODE_HOSTNAME} would result in my-service-minion-001 on a mesos node minion-001 and my-service-minion-002 on a mesos node minion-002.

@aquamatthias
Copy link
Contributor

I close this ticket, since the docker params are working, but do not serve the intention of setting a hostname. Please open a separate feature request for this.

@mesosphere mesosphere locked and limited conversation to collaborators Mar 27, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants