Uploaded image for project: 'Marathon'
  1. Marathon
  2. MARATHON-1969

Reconcile port definitions and Docker ports

    Details

    • Type: Task
    • Status: Resolved
    • Priority: Medium
    • Resolution: Done
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: None

      Description

      Hello,

      I am launching a database inside a Docker container with Marathon. I defined a mapping to expose a port on the Docker container to an explicit port on the host. I want also to label this port with some additional information so I defined a portDefinition for this port. It looks like Marathon is ignoring this port definition.

      App definition sent:

      {
          "container": {
              "docker": {
                  "network": "BRIDGE",
                  "parameters": [],
                  "image": "mysql:5.7.12",
                  "forcePullImage": true,
                  "portMappings": [{
                      "containerPort": 3306,
                      "hostPort": 4306
                  }],
                  "privileged": false
              },
              "type": "DOCKER",
              "volumes": [{
                  "hostPath": "/srv/docker/airflow_db/data",
                  "containerPath": "/var/lib/mysql",
                  "mode": "RW"
              }]
          },
          "backoffFactor": 1.15,
          "mem": 256.0,
          "backoffSeconds": 1.0,
          "cpus": 0.2,
          "requirePorts": true,
          "instances": 1,
          "env": {
              "MYSQL_PASSWORD": "airflow",
              "MYSQL_ROOT_PASSWORD": "admin",
              "MYSQL_USER": "airflow",
              "MYSQL_DATABASE": "airflow"
          },
          "healthChecks": [{
              "protocol": "COMMAND",
              "timeoutSeconds": 10,
              "intervalSeconds": 20,
              "gracePeriodSeconds": 300,
              "command": {
                  "value": "/usr/bin/mysql --host=localhost --port=3306 --user=airflow --password=airflow -e 'show databases;' | grep information_schema"
              },
              "maxConsecutiveFailures": 5
          }],
          "portDefinitions": [{
              "protocol": "tcp",
              "name": "mysql",
              "port": 4306
          }],
          "id": "/airflow/db",
          "maxLaunchDelaySeconds": 3600.0
      }
      

      Actual app definition fetched from Marathon:

      {
          "app": {
              "id": "/airflow/db",
              "cmd": null,
              "args": null,
              "user": null,
              "env": {
                  "MYSQL_PASSWORD": "airflow",
                  "MYSQL_ROOT_PASSWORD": "admin",
                  "MYSQL_USER": "airflow",
                  "MYSQL_DATABASE": "airflow"
              },
              "instances": 1,
              "cpus": 0.2,
              "mem": 256,
              "disk": 0,
              "executor": "",
              "constraints": [],
              "uris": [],
              "fetch": [],
              "storeUrls": [],
              "ports": [10000],
              "portDefinitions": [{
                  "port": 10000,
                  "protocol": "tcp",
                  "name": "mysql",
                  "labels": {}
              }],
              "requirePorts": true,
              "backoffSeconds": 1,
              "backoffFactor": 1.15,
              "maxLaunchDelaySeconds": 3600,
              "container": {
                  "type": "DOCKER",
                  "volumes": [{
                      "containerPath": "/var/lib/mysql",
                      "hostPath": "/srv/docker/airflow_db/data",
                      "mode": "RW"
                  }],
                  "docker": {
                      "image": "mysql:5.7.12",
                      "network": "BRIDGE",
                      "portMappings": [{
                          "containerPort": 3306,
                          "hostPort": 4306,
                          "servicePort": 10000,
                          "protocol": "tcp",
                          "labels": {}
                      }],
                      "privileged": false,
                      "parameters": [],
                      "forcePullImage": true
                  }
              },
              "healthChecks": [{
                  "protocol": "COMMAND",
                  "command": {
                      "value": "/usr/bin/mysql --host=localhost --port=3306 --user=airflow --password=airflow -e 'show databases;' | grep information_schema"
                  },
                  "gracePeriodSeconds": 300,
                  "intervalSeconds": 20,
                  "timeoutSeconds": 10,
                  "maxConsecutiveFailures": 5,
                  "ignoreHttp1xx": false
              }],
              "readinessChecks": [],
              "dependencies": [],
              "upgradeStrategy": {
                  "minimumHealthCapacity": 1,
                  "maximumOverCapacity": 1
              },
              "labels": {},
              "acceptedResourceRoles": null,
              "ipAddress": null,
              "version": "2016-05-04T11:04:54.171Z",
              "residency": null,
              "versionInfo": {
                  "lastScalingAt": "2016-05-04T11:04:54.171Z",
                  "lastConfigChangeAt": "2016-05-04T11:04:54.171Z"
              },
              "tasksStaged": 0,
              "tasksRunning": 1,
              "tasksHealthy": 1,
              "tasksUnhealthy": 0,
              "deployments": [],
              "tasks": [{
                  "id": "airflow_db.08947334-11e8-11e6-b2e2-0af38d20c4f2",
                  "slaveId": "7b9196c8-69ea-47db-9660-719803e4551b-S0",
                  "host": "host1",
                  "startedAt": "2016-05-04T11:04:58.596Z",
                  "stagedAt": "2016-05-04T11:04:55.595Z",
                  "ports": [4306],
                  "version": "2016-05-04T11:04:54.171Z",
                  "ipAddresses": [{
                      "ipAddress": "10.0.2.15",
                      "protocol": "IPv4"
                  }],
                  "appId": "/airflow/db",
                  "healthCheckResults": [{
                      "alive": true,
                      "consecutiveFailures": 0,
                      "firstSuccess": "2016-05-04T11:04:58.935Z",
                      "lastFailure": null,
                      "lastSuccess": "2016-05-04T11:04:58.935Z",
                      "lastFailureCause": null,
                      "taskId": "airflow_db.08947334-11e8-11e6-b2e2-0af38d20c4f2"
                  }]
              }]
          }
      }
      

      My portsDefinition is ignored by Marathon (version 1.1.1)

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                jdef James DeFelice
                Reporter:
                GitHub_ludovicc Ludovic Claude (Inactive)
                Team:
                Orchestration Team
                Watchers:
                Chmielewski, James DeFelice, Jason Gilanfarr (Inactive)
              • Watchers:
                3 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: